mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-04 19:02:28 +00:00
core: add nonce field to transaction
1. Closes #840: added Nonce field to transaction.Transaction and removed Nonce field from transaction.MinerTx 2. Added following methods to different tx types: - NewMinerTx() - NewMinerTxWithNonce(...) - NewEnrollmentTx(...) - NewIssueTx() - NewPublishTx(...) - NewRegisterTx(...) - NewStateTx(...) in order to avoid code duplication when new transaction is created. 3. Commented out test cases where binary transaction/block are used. These test cases marked with `TODO NEO3.0: Update binary` and need to be updated. 4. Updated other tests 5. Added constant Nonce to GoveringTockenTx, UtilityTokenTx and genesis block to avoid data variability. Also marked with TODO.
This commit is contained in:
parent
d1f92a585b
commit
65503aa9b4
34 changed files with 354 additions and 332 deletions
|
@ -16,7 +16,11 @@ func TestGenesisBlockMainNet(t *testing.T) {
|
|||
block, err := createGenesisBlock(cfg.ProtocolConfiguration)
|
||||
require.NoError(t, err)
|
||||
|
||||
expect := "d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf"
|
||||
//TODO: After we added Nonce field to transaction.Transaction, goveringTockenTx and UtilityTockenTx hashes
|
||||
// have been changed. Consequently, hash of the genesis block has been changed.
|
||||
// Update expected genesis block hash for better times.
|
||||
// Old hash is "d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf"
|
||||
expect := "8c5e44474b2b942286071254fd4bffddd3febd0511b101e566331b5f8f041902"
|
||||
assert.Equal(t, expect, block.Hash().StringLE())
|
||||
}
|
||||
|
||||
|
@ -40,11 +44,17 @@ func TestGetConsensusAddressMainNet(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUtilityTokenTX(t *testing.T) {
|
||||
expect := "602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7"
|
||||
//TODO: After we added Nonce field to transaction.Transaction, UtilityTockenTx hash
|
||||
// has been changed. Update it for better times.
|
||||
// Old hash is "602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7"
|
||||
expect := "057ea06225860f0f7e69cca1e0052652918629929591b8138a516431be144ba8"
|
||||
assert.Equal(t, expect, UtilityTokenID().StringLE())
|
||||
}
|
||||
|
||||
func TestGoverningTokenTX(t *testing.T) {
|
||||
expect := "c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b"
|
||||
//TODO: After we added Nonce field to transaction.Transaction, GoveringTockenTx hash
|
||||
// has been changed. Update it for better times.
|
||||
// Old hash is "c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b"
|
||||
expect := "cd3a3b5654465238c3a4ac30eeb1bfd1171378d59b27f7d2e6893ce9d6150825"
|
||||
assert.Equal(t, expect, GoverningTokenID().StringLE())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue