core: fix failing mempool test
There might be a case when identical nonces are generated for tx6, tx7 or tx8 (they are not in mempool, so each of them pass mempool-presence check). In this case test fails due to the lack of hashes into mp.conflicts map (two of tx6, tx7 or tx8 have identical hashes) with the following error: ``` === RUN TestMempoolAddRemoveConflicts --- FAIL: TestMempoolAddRemoveConflicts (0.00s) mem_pool_test.go:376: Error Trace: mem_pool_test.go:376 Error: Not equal: expected: 4 actual : 3 Test: TestMempoolAddRemoveConflicts ``` Fixed by maling the nonce non-random.
This commit is contained in:
parent
e664657c8c
commit
54e6bcad12
1 changed files with 6 additions and 4 deletions
|
@ -308,13 +308,15 @@ func TestMempoolItemsOrder(t *testing.T) {
|
|||
func TestMempoolAddRemoveConflicts(t *testing.T) {
|
||||
capacity := 6
|
||||
mp := New(capacity)
|
||||
var fs = &FeerStub{
|
||||
p2pSigExt: true,
|
||||
}
|
||||
var (
|
||||
fs = &FeerStub{p2pSigExt: true}
|
||||
nonce uint32 = 1
|
||||
)
|
||||
getConflictsTx := func(netFee int64, hashes ...util.Uint256) *transaction.Transaction {
|
||||
tx := transaction.New(netmode.UnitTestNet, []byte{byte(opcode.PUSH1)}, 0)
|
||||
tx.NetworkFee = netFee
|
||||
tx.Nonce = uint32(random.Int(0, 1e4))
|
||||
tx.Nonce = nonce
|
||||
nonce++
|
||||
tx.Signers = []transaction.Signer{{Account: util.Uint160{1, 2, 3}}}
|
||||
tx.Attributes = make([]transaction.Attribute, len(hashes))
|
||||
for i, h := range hashes {
|
||||
|
|
Loading…
Reference in a new issue