decred / dcrdex

The Decred Decentralized Exchange (DEX), powered by atomic-swaps.
Other
181 stars 89 forks source link

btcd / neutrino regtest does diff retargeting, but bitcoind does not #2255

Closed buck54321 closed 9 months ago

buck54321 commented 1 year ago

Bitcoin native SPV connects by default to the simnet harness alpha node. Yesterday afternoon, I created a new wallet and had zero peers. Restarting the client did not fix it. Restarting the harness did fix it. Left client running overnight. This morning I see a notification that the wallet has no peers again.

Nothing notable logged for the client.

Alpha node logs

2023-03-25T13:54:50Z connection from 127.0.0.1:46286 accepted
2023-03-25T13:54:50Z received: version (122 bytes) peer=3655
2023-03-25T13:54:50Z sending version (102 bytes) peer=3655
2023-03-25T13:54:50Z send version message: version 70016, blocks=5251, txrelay=1, peer=3655
2023-03-25T13:54:50Z sending wtxidrelay (0 bytes) peer=3655
2023-03-25T13:54:50Z sending sendaddrv2 (0 bytes) peer=3655
2023-03-25T13:54:50Z sending verack (0 bytes) peer=3655
2023-03-25T13:54:50Z receive version message: /btcwire:0.5.0/neutrino:0.12.0-beta/: version 70016, blocks=4031, us=127.0.0.1:20575, txrelay=0, peer=3655
2023-03-25T13:54:50Z received: sendaddrv2 (0 bytes) peer=3655
2023-03-25T13:54:50Z received: verack (0 bytes) peer=3655
2023-03-25T13:54:50Z sending sendheaders (0 bytes) peer=3655
2023-03-25T13:54:50Z sending sendcmpct (9 bytes) peer=3655
2023-03-25T13:54:50Z sending sendcmpct (9 bytes) peer=3655
2023-03-25T13:54:50Z sending ping (8 bytes) peer=3655
2023-03-25T13:54:50Z sending feefilter (8 bytes) peer=3655
2023-03-25T13:54:50Z received: pong (8 bytes) peer=3655
2023-03-25T13:54:50Z received: getheaders (741 bytes) peer=3655
2023-03-25T13:54:50Z getheaders 4032 to end from peer=3655
2023-03-25T13:54:50Z sending headers (98823 bytes) peer=3655
2023-03-25T13:54:50Z socket closed for peer=3655
2023-03-25T13:54:50Z disconnecting peer=3655

Log sequence repeats periodically. Connection is clearly made, information is exchanged apparently successfully. Then the connection is inexplicably dropped.

chappjc commented 1 year ago

Nothing notable logged for the client.

How about neutrino.log?

buck54321 commented 1 year ago

Nothing notable logged for the client.

How about neutrino.log?

Bingo. Thanks. Still don't know how it would get to this state.

2023-03-25 09:24:24.928 [WRN] NTRNO: Header doesn't pass sanity check: block target difficulty of 7fffff0000000000000000000000000000000000000000000000000000000000 is higher than max of 1fffff0000000000000000000000000000000000000000000000000000000000 -- disconnecting peer
2023-03-25 09:24:24.929 [DBG] NTRNO: Removed peer 127.0.0.1:20575 (outbound)
chappjc commented 1 year ago

Still don't know how it would get to this state.

No clue. https://github.com/lightningnetwork/lnd/issues/6938#issuecomment-1263925295 https://github.com/lightninglabs/neutrino/issues/211

chappjc commented 1 year ago

Based on the linked issues with ln, maybe not something we're doing wrong. Can close?

Can close when we update btcd dep with the following merged: https://github.com/lightninglabs/neutrino/pull/256

chappjc commented 1 year ago

Update. btcd fix is merged, in https://github.com/btcsuite/btcd/pull/1985. Then the neutrino fix that uses the newly exported btcd functions is in https://github.com/lightninglabs/neutrino/pull/283, which looks to be almost ready to merge. When that goes in, we can update both btcd and neutrino's requires to get this issue resolved.