transaction: cache tx size, don't serialize it over and over again
This commit is contained in:
parent
a6a1df4e0d
commit
19c69618c5
5 changed files with 21 additions and 11 deletions
|
@ -524,8 +524,8 @@ func TestGetTransaction(t *testing.T) {
|
|||
tx, height, err := bc.GetTransaction(block.Transactions[0].Hash())
|
||||
require.Nil(t, err)
|
||||
assert.Equal(t, block.Index, height)
|
||||
assert.Equal(t, txSize, tx.Size())
|
||||
assert.Equal(t, block.Transactions[0], tx)
|
||||
assert.Equal(t, txSize, io.GetVarSize(tx))
|
||||
assert.Equal(t, 1, io.GetVarSize(tx.Attributes))
|
||||
assert.Equal(t, 1, io.GetVarSize(tx.Scripts))
|
||||
assert.NoError(t, bc.persist())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue