Closed dsaveliev closed 5 years ago
Fixes #546
In fact, there are two distinct problems:
Timing issue with the nodes synchronization. It's possible for the newly connected node to get inv message before actual blocks sync. That leads to the orphan transaction:
3602: node3 2019-03-22 13:42:56.604965 [ net] got inv: tx b1e679dd7aebafc19d28af540b04b2e3ce41933aabfbe3c9a0b03230a8e78332 new peer=0 3603: node3 2019-03-22 13:42:56.605022 [ net] askfor witness-tx b1e679dd7aebafc19d28af540b04b2e3ce41933aabfbe3c9a0b03230a8e78332 0 (00:00:00) peer=0 3605: node3 2019-03-22 13:42:56.605065 [ net] Requesting witness-tx b1e679dd7aebafc19d28af540b04b2e3ce41933aabfbe3c9a0b03230a8e78332 peer=0 3860: node3 2019-03-22 13:42:56.629719 [ mempool] stored orphan tx b1e679dd7aebafc19d28af540b04b2e3ce41933aabfbe3c9a0b03230a8e78332 (mapsz 1 outsz 1)
During the sendtoaddress call it's possible to get such combination of coins that the fee of '0.01' wouldn't be enough:
test_framework.authproxy.JSONRPCException: Error: This transaction requires a transaction fee of at least 0.10
I adjusted the test a little bit to overcome both issues.
P.S.: Additional investigation regarding the first case:
Actual timeout happened during sync_blocks call.
sync_blocks
This is an example of successful handling of an orphan transaction - there is almost ~2 sec between inv message and acceptance to the mempool:
inv
51980: node1 2019-04-01 14:18:30.314298 [ net] got inv: tx 83b20b8f0f93ede1b56589cb65d915d13d19a66c31a2a7bf27113f97f04d3481 new peer=1 51981: node1 2019-04-01 14:18:30.314529 [ net] askfor witness-tx 83b20b8f0f93ede1b56589cb65d915d13d19a66c31a2a7bf27113f97f04d3481 0 (00:00:00) peer=1 51982: node1 2019-04-01 14:18:30.314871 [ net] Requesting witness-tx 83b20b8f0f93ede1b56589cb65d915d13d19a66c31a2a7bf27113f97f04d3481 peer=1 51986: node0 2019-04-01 14:18:30.316201 [ net] received getdata for: witness-tx 83b20b8f0f93ede1b56589cb65d915d13d19a66c31a2a7bf27113f97f04d3481 peer=1 51990: node1 2019-04-01 14:18:30.318366 [ mempool] stored orphan tx 83b20b8f0f93ede1b56589cb65d915d13d19a66c31a2a7bf27113f97f04d3481 (mapsz 1 outsz 1) 52015: node1 2019-04-01 14:18:33.848710 [ net] got inv: tx 83b20b8f0f93ede1b56589cb65d915d13d19a66c31a2a7bf27113f97f04d3481 have peer=0 52507: node1 2019-04-01 14:20:29.387219 [ mempool] accepted orphan tx 83b20b8f0f93ede1b56589cb65d915d13d19a66c31a2a7bf27113f97f04d3481 52586: node0 2019-04-01 14:20:30.037016 [ ] AddToWallet 83b20b8f0f93ede1b56589cb65d915d13d19a66c31a2a7bf27113f97f04d3481 update
This is failed test - node3 got the inv message ~2 sec before sync_blocks timeout:
node3
3602: node3 2019-03-22 13:42:56.604965 [ net] got inv: tx b1e679dd7aebafc19d28af540b04b2e3ce41933aabfbe3c9a0b03230a8e78332 new peer=0 3603: node3 2019-03-22 13:42:56.605022 [ net] askfor witness-tx b1e679dd7aebafc19d28af540b04b2e3ce41933aabfbe3c9a0b03230a8e78332 0 (00:00:00) peer=0 3605: node3 2019-03-22 13:42:56.605065 [ net] Requesting witness-tx b1e679dd7aebafc19d28af540b04b2e3ce41933aabfbe3c9a0b03230a8e78332 peer=0 3860: node3 2019-03-22 13:42:56.629719 [ mempool] stored orphan tx b1e679dd7aebafc19d28af540b04b2e3ce41933aabfbe3c9a0b03230a8e78332 (mapsz 1 outsz 1) 5046: node3 2019-03-22 13:43:18.805934 [ net] got inv: tx b1e679dd7aebafc19d28af540b04b2e3ce41933aabfbe3c9a0b03230a8e78332 have peer=1 ... 5147: test 2019-03-22 13:45:27.704000 TestFramework (ERROR): Assertion failed
Summary - node3 got the inv too late, so it makes sense to load blocks in advance to avoid such situations.
Signed-off-by: Dmitry Saveliev dima@thirdhash.com
Fixes #546
In fact, there are two distinct problems:
Timing issue with the nodes synchronization. It's possible for the newly connected node to get inv message before actual blocks sync. That leads to the orphan transaction:
During the sendtoaddress call it's possible to get such combination of coins that the fee of '0.01' wouldn't be enough:
I adjusted the test a little bit to overcome both issues.
P.S.: Additional investigation regarding the first case:
Actual timeout happened during
sync_blocks
call.This is an example of successful handling of an orphan transaction - there is almost ~2 sec between
inv
message and acceptance to the mempool:This is failed test -
node3
got theinv
message ~2 sec beforesync_blocks
timeout:Summary -
node3
got theinv
too late, so it makes sense to load blocks in advance to avoid such situations.Signed-off-by: Dmitry Saveliev dima@thirdhash.com