mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 23:33:37 +00:00
commit
67219b9439
7 changed files with 11 additions and 11 deletions
|
@ -464,7 +464,7 @@ func (bc *Blockchain) storeBlock(block *Block) error {
|
||||||
func (bc *Blockchain) persist(ctx context.Context) error {
|
func (bc *Blockchain) persist(ctx context.Context) error {
|
||||||
var (
|
var (
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
persisted = 0
|
persisted int
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func TestEncodeDecodeContractState(t *testing.T) {
|
||||||
ParamList: []smartcontract.ParamType{smartcontract.StringType, smartcontract.IntegerType, smartcontract.Hash160Type},
|
ParamList: []smartcontract.ParamType{smartcontract.StringType, smartcontract.IntegerType, smartcontract.Hash160Type},
|
||||||
ReturnType: smartcontract.BoolType,
|
ReturnType: smartcontract.BoolType,
|
||||||
Properties: smartcontract.HasStorage,
|
Properties: smartcontract.HasStorage,
|
||||||
Name: "Contracto",
|
Name: "Contrato",
|
||||||
CodeVersion: "1.0.0",
|
CodeVersion: "1.0.0",
|
||||||
Author: "Joe Random",
|
Author: "Joe Random",
|
||||||
Email: "joe@example.com",
|
Email: "joe@example.com",
|
||||||
|
@ -61,7 +61,7 @@ func TestPutGetDeleteContractState(t *testing.T) {
|
||||||
ParamList: []smartcontract.ParamType{smartcontract.StringType, smartcontract.IntegerType, smartcontract.Hash160Type},
|
ParamList: []smartcontract.ParamType{smartcontract.StringType, smartcontract.IntegerType, smartcontract.Hash160Type},
|
||||||
ReturnType: smartcontract.BoolType,
|
ReturnType: smartcontract.BoolType,
|
||||||
Properties: smartcontract.HasStorage,
|
Properties: smartcontract.HasStorage,
|
||||||
Name: "Contracto",
|
Name: "Contrato",
|
||||||
CodeVersion: "1.0.0",
|
CodeVersion: "1.0.0",
|
||||||
Author: "Joe Random",
|
Author: "Joe Random",
|
||||||
Email: "joe@example.com",
|
Email: "joe@example.com",
|
||||||
|
|
|
@ -417,7 +417,7 @@ func (ic *interopContext) storageFind(v *vm.VM) error {
|
||||||
*/
|
*/
|
||||||
// createContractStateFromVM pops all contract state elements from the VM
|
// createContractStateFromVM pops all contract state elements from the VM
|
||||||
// evaluation stack, does a lot of checks and returns ContractState if it
|
// evaluation stack, does a lot of checks and returns ContractState if it
|
||||||
// succeedes.
|
// succeeds.
|
||||||
func (ic *interopContext) createContractStateFromVM(v *vm.VM) (*ContractState, error) {
|
func (ic *interopContext) createContractStateFromVM(v *vm.VM) (*ContractState, error) {
|
||||||
if ic.trigger != 0x10 {
|
if ic.trigger != 0x10 {
|
||||||
return nil, errors.New("can't create contract when not triggered by an application")
|
return nil, errors.New("can't create contract when not triggered by an application")
|
||||||
|
|
|
@ -21,7 +21,7 @@ type LevelDBStore struct {
|
||||||
// NewLevelDBStore return a new LevelDBStore object that will
|
// NewLevelDBStore return a new LevelDBStore object that will
|
||||||
// initialize the database found at the given path.
|
// initialize the database found at the given path.
|
||||||
func NewLevelDBStore(cfg LevelDBOptions) (*LevelDBStore, error) {
|
func NewLevelDBStore(cfg LevelDBOptions) (*LevelDBStore, error) {
|
||||||
var opts *opt.Options = nil // should be exposed via LevelDBOptions if anything needed
|
var opts *opt.Options // should be exposed via LevelDBOptions if anything needed
|
||||||
|
|
||||||
db, err := leveldb.OpenFile(cfg.DataDirectoryPath, opts)
|
db, err := leveldb.OpenFile(cfg.DataDirectoryPath, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -22,7 +22,7 @@ func TestWriteLE(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
val uint32 = 0xdeadbeef
|
val uint32 = 0xdeadbeef
|
||||||
readval uint32
|
readval uint32
|
||||||
bin []byte = []byte{0xef, 0xbe, 0xad, 0xde}
|
bin = []byte{0xef, 0xbe, 0xad, 0xde}
|
||||||
)
|
)
|
||||||
bw := NewBufBinWriter()
|
bw := NewBufBinWriter()
|
||||||
bw.WriteLE(val)
|
bw.WriteLE(val)
|
||||||
|
@ -39,7 +39,7 @@ func TestWriteBE(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
val uint32 = 0xdeadbeef
|
val uint32 = 0xdeadbeef
|
||||||
readval uint32
|
readval uint32
|
||||||
bin []byte = []byte{0xde, 0xad, 0xbe, 0xef}
|
bin = []byte{0xde, 0xad, 0xbe, 0xef}
|
||||||
)
|
)
|
||||||
bw := NewBufBinWriter()
|
bw := NewBufBinWriter()
|
||||||
bw.WriteBE(val)
|
bw.WriteBE(val)
|
||||||
|
@ -115,7 +115,7 @@ func TestBufBinWriterReset(t *testing.T) {
|
||||||
|
|
||||||
func TestWriteString(t *testing.T) {
|
func TestWriteString(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
str string = "teststring"
|
str = "teststring"
|
||||||
)
|
)
|
||||||
bw := NewBufBinWriter()
|
bw := NewBufBinWriter()
|
||||||
bw.WriteString(str)
|
bw.WriteString(str)
|
||||||
|
|
|
@ -115,7 +115,7 @@ func (d *DefaultDiscovery) BadPeers() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GoodPeers returns all addresses of known good peers (that at least once
|
// GoodPeers returns all addresses of known good peers (that at least once
|
||||||
// succeded handshaking with us).
|
// succeeded handshaking with us).
|
||||||
func (d *DefaultDiscovery) GoodPeers() []string {
|
func (d *DefaultDiscovery) GoodPeers() []string {
|
||||||
addrs := make([]string, 0, len(d.goodAddrs))
|
addrs := make([]string, 0, len(d.goodAddrs))
|
||||||
for addr := range d.goodAddrs {
|
for addr := range d.goodAddrs {
|
||||||
|
@ -125,7 +125,7 @@ func (d *DefaultDiscovery) GoodPeers() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterGoodAddr registers good known connected address that passed
|
// RegisterGoodAddr registers good known connected address that passed
|
||||||
// handshake successfuly.
|
// handshake successfully.
|
||||||
func (d *DefaultDiscovery) RegisterGoodAddr(s string) {
|
func (d *DefaultDiscovery) RegisterGoodAddr(s string) {
|
||||||
d.goodCh <- s
|
d.goodCh <- s
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ func (p *AddressAndTime) EncodeBinary(bw *io.BinWriter) {
|
||||||
|
|
||||||
// IPPortString makes a string from IP and port specified.
|
// IPPortString makes a string from IP and port specified.
|
||||||
func (p *AddressAndTime) IPPortString() string {
|
func (p *AddressAndTime) IPPortString() string {
|
||||||
var netip net.IP = make(net.IP, 16)
|
var netip = make(net.IP, 16)
|
||||||
|
|
||||||
copy(netip, p.IP[:])
|
copy(netip, p.IP[:])
|
||||||
port := strconv.Itoa(int(p.Port))
|
port := strconv.Itoa(int(p.Port))
|
||||||
|
|
Loading…
Reference in a new issue