mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-05 23:55:11 +00:00
core: refactor (*DAO).StoreAsTransaction
Squash (*DAO).StoreAsTransaction and (*DAO).StoreConflictingTransactions. It's better to keep them this way, because StoreAsTransaction is always followed by StoreConflictingTransactions, so it's an atomic operation. The logic wasn't changed.
This commit is contained in:
parent
4b35a1cf92
commit
5f9d38f640
4 changed files with 95 additions and 39 deletions
|
@ -792,9 +792,16 @@ func TestVerifyTx(t *testing.T) {
|
|||
t.Run("dummy on-chain conflict", func(t *testing.T) {
|
||||
tx := bc.newTestTx(h, testScript)
|
||||
require.NoError(t, accs[0].SignTx(netmode.UnitTestNet, tx))
|
||||
dummyTx := transaction.NewTrimmedTX(tx.Hash())
|
||||
dummyTx.Version = transaction.DummyVersion
|
||||
require.NoError(t, bc.dao.StoreAsTransaction(dummyTx, bc.blockHeight, nil))
|
||||
conflicting := transaction.New([]byte{byte(opcode.RET)}, 1)
|
||||
conflicting.Attributes = []transaction.Attribute{
|
||||
{
|
||||
Type: transaction.ConflictsT,
|
||||
Value: &transaction.Conflicts{
|
||||
Hash: tx.Hash(),
|
||||
},
|
||||
},
|
||||
}
|
||||
require.NoError(t, bc.dao.StoreAsTransaction(conflicting, bc.blockHeight, nil))
|
||||
require.True(t, errors.Is(bc.VerifyTx(tx), ErrHasConflicts))
|
||||
})
|
||||
t.Run("attribute on-chain conflict", func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue