Fix broken call to sendmany in p2p_stresstest
Summary
Closes issue #375 (closed)
This bug was introduced by MR !1264 (merged). It turns out sendmany
calls were
specified wrong by the original programmer implementing !1264 (merged) (me) and
they would "silently fail" and fall back to a different sendtoaddress
call.
What's more, the script intended on alternating between sendmany
and sendtoaddress
for every other call, and it managed to not do that
correctly either (sorry!).
Furthermore, the silent failures were strange and outside the way any such test framework script operates.
I have modified the script to just fail if either of these calls fail, and to not use any "fallback" technique.
Anyway, the script was fixed and the sendmany
call works now. It alternates between sendmany
and sendtoaddress
just to provide a fuller testing coverage.
Test Plan
Try and reproduce the failure seen in #375 (closed) both with and without this MR. This MR should fix things. Also, for node1's log you should eventually see things like this:
2021-12-13T23:25:13.321131Z Received a POST request for / from 127.0.0.1:60296
2021-12-13T23:25:13.399559Z ThreadRPCServer method=sendtoaddress
2021-12-13T23:25:13.439612Z [default wallet] keypool reserve 104
2021-12-13T23:25:13.440946Z [default wallet] keypool return 104
2021-12-13T23:25:13.461382Z [default wallet] CommitTransaction:
CTransaction(txid=c52b73dc8f, ver=2, vin.size=1, vout.size=1, nLockTime=243)
CTxIn(COutPoint(0e4186629a, 98), scriptSig=47304402203408216e315e77, nSequence=4294967294)
CTxOut(nValue=0.12128521, scriptPubKey=76a9142e48cda73938ef079fd78e4b)
2021-12-13T23:25:13.461518Z [default wallet] AddToWallet c52b73dc8fad41dbd8527b2e30894c5275697177b625b0dc74616357176952b4 new
2021-12-13T23:25:13.524828Z [default wallet] Relaying wtx c52b73dc8fad41dbd8527b2e30894c5275697177b625b0dc74616357176952b4
2021-12-13T23:25:13.545356Z [default wallet] AddToWallet c52b73dc8fad41dbd8527b2e30894c5275697177b625b0dc74616357176952b4
2021-12-13T23:25:13.546317Z Received a POST request for / from 127.0.0.1:60296
2021-12-13T23:25:13.607495Z ThreadRPCServer method=sendmany
2021-12-13T23:25:13.627585Z [default wallet] keypool reserve 104
2021-12-13T23:25:13.628386Z [default wallet] keypool return 104
2021-12-13T23:25:13.628983Z [default wallet] CommitTransaction:
CTransaction(txid=1f4dd0860e, ver=2, vin.size=1, vout.size=1, nLockTime=243)
CTxIn(COutPoint(0e4186629a, 99), scriptSig=47304402207e3286923dde5b, nSequence=4294967294)
CTxOut(nValue=0.12128521, scriptPubKey=76a914ca3fb0cbbaa6b041c1871122)
2021-12-13T23:25:13.629143Z [default wallet] AddToWallet 1f4dd0860e7cac513d3b81170ad4a4fd14ff82f83a6b7a508c2a6d6a9159f4a8 new
2021-12-13T23:25:13.765662Z [default wallet] Relaying wtx 1f4dd0860e7cac513d3b81170ad4a4fd14ff82f83a6b7a508c2a6d6a9159f4a8
2021-12-13T23:25:13.766211Z [default wallet] AddToWallet 1f4dd0860e7cac513d3b81170ad4a4fd14ff82f83a6b7a508c2a6d6a9159f4a8
Note how every other call is: sendmany
and then sendtoaddress
. It should flip/flop between both and each call should result in a "CommitTransaction" message (if it doesn't it means there was an error).