adm: Fix morph init --local-dump
#55
2 changed files with 24 additions and 1 deletions
|
@ -27,6 +27,9 @@ func TestInitialize(t *testing.T) {
|
||||||
// It is here for performing local testing after the changes.
|
// It is here for performing local testing after the changes.
|
||||||
t.Skip()
|
t.Skip()
|
||||||
|
|
||||||
|
t.Run("1 nodes", func(t *testing.T) {
|
||||||
|
testInitialize(t, 1)
|
||||||
|
})
|
||||||
t.Run("4 nodes", func(t *testing.T) {
|
t.Run("4 nodes", func(t *testing.T) {
|
||||||
testInitialize(t, 4)
|
testInitialize(t, 4)
|
||||||
})
|
})
|
||||||
|
@ -96,6 +99,7 @@ func generateTestData(t *testing.T, dir string, size int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := config.Config{}
|
cfg := config.Config{}
|
||||||
|
cfg.ProtocolConfiguration.Magic = 12345
|
||||||
cfg.ProtocolConfiguration.ValidatorsCount = size
|
cfg.ProtocolConfiguration.ValidatorsCount = size
|
||||||
cfg.ProtocolConfiguration.SecondsPerBlock = 1
|
cfg.ProtocolConfiguration.SecondsPerBlock = 1
|
||||||
cfg.ProtocolConfiguration.StandbyCommittee = pubs // sorted by glagolic letters
|
cfg.ProtocolConfiguration.StandbyCommittee = pubs // sorted by glagolic letters
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||||
|
@ -20,6 +21,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
|
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
|
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
|
||||||
|
@ -226,7 +228,24 @@ func (l *localClient) TraverseIterator(_, _ uuid.UUID, _ int) ([]stackitem.Item,
|
||||||
|
|
||||||
// GetVersion return default version.
|
// GetVersion return default version.
|
||||||
func (l *localClient) GetVersion() (*result.Version, error) {
|
func (l *localClient) GetVersion() (*result.Version, error) {
|
||||||
return &result.Version{}, nil
|
c := l.bc.GetConfig()
|
||||||
|
return &result.Version{
|
||||||
|
Protocol: result.Protocol{
|
||||||
|
AddressVersion: address.NEO3Prefix,
|
||||||
|
Network: c.Magic,
|
||||||
|
MillisecondsPerBlock: int(c.TimePerBlock / time.Millisecond),
|
||||||
|
MaxTraceableBlocks: c.MaxTraceableBlocks,
|
||||||
|
MaxValidUntilBlockIncrement: c.MaxValidUntilBlockIncrement,
|
||||||
|
MaxTransactionsPerBlock: c.MaxTransactionsPerBlock,
|
||||||
|
MemoryPoolMaxTransactions: c.MemPoolSize,
|
||||||
|
ValidatorsCount: byte(c.ValidatorsCount),
|
||||||
|
InitialGasDistribution: c.InitialGASSupply,
|
||||||
|
CommitteeHistory: c.CommitteeHistory,
|
||||||
|
P2PSigExtensions: c.P2PSigExtensions,
|
||||||
|
StateRootInHeader: c.StateRootInHeader,
|
||||||
|
ValidatorsHistory: c.ValidatorsHistory,
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *localClient) InvokeContractVerify(contract util.Uint160, params []smartcontract.Parameter, signers []transaction.Signer, witnesses ...transaction.Witness) (*result.Invoke, error) {
|
func (l *localClient) InvokeContractVerify(contract util.Uint160, params []smartcontract.Parameter, signers []transaction.Signer, witnesses ...transaction.Witness) (*result.Invoke, error) {
|
||||||
|
|
Loading…
Reference in a new issue