piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 09, 2016, 07:25:34 PM |
|
But is says "We saw b2 first so it takes priority." So b3 should be orphaned... Or not?
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
hhanh00
|
|
April 09, 2016, 07:39:35 PM |
|
Oops, you are right. I thought that was b2. How about: Commiting block 0b1c05438c178aa1976b713a0b794d705f955b99236a2bcc9cd8609b68db92bf -> 7cd3ee22eab70c6bc23fe7d43c19a797eb9529e9c9bc71aaca6c8b9f9c3496f4 Undo block 102 748223dc39df65a8c88ef9af80f98cbf130a2f8cfdf1900ff84f1bcf1fcc04b2 0 KB - New TOP 103 Current last 0b1c05438c178aa1976b713a0b794d705f955b99236a2bcc9cd8609b68db92bf
GetHeaders 1 up to 0000000000000000000000000000000000000000000000000000000000000000 ? 748223dc39df65a8c88ef9af80f98cbf130a2f8cfdf1900ff84f1bcf1fcc04b2 found: true sending back 0 headers
Isn't it supposed to return the new fork?
|
|
|
|
piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 09, 2016, 07:46:05 PM |
|
Commiting block 0b1c05438c178aa1976b713a0b794d705f955b99236a2bcc9cd8609b68db92bf -> 7cd3ee22eab70c6bc23fe7d43c19a797eb9529e9c9bc71aaca6c8b9f9c3496f4 Undo block 102 748223dc39df65a8c88ef9af80f98cbf130a2f8cfdf1900ff84f1bcf1fcc04b2 0 KB - New TOP 103 Current last 0b1c05438c178aa1976b713a0b794d705f955b99236a2bcc9cd8609b68db92bf
GetHeaders 1 up to 0000000000000000000000000000000000000000000000000000000000000000 ? 748223dc39df65a8c88ef9af80f98cbf130a2f8cfdf1900ff84f1bcf1fcc04b2 found: true sending back 0 headers
Isn't it supposed to return the new fork? I don't think so, because 748223dc39df65a8c88ef9af80f98cbf130a2f8cfdf1900ff84f1bcf1fcc04b2 has no children.
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
hhanh00
|
|
April 09, 2016, 08:24:36 PM |
|
Commiting block 0b1c05438c178aa1976b713a0b794d705f955b99236a2bcc9cd8609b68db92bf -> 7cd3ee22eab70c6bc23fe7d43c19a797eb9529e9c9bc71aaca6c8b9f9c3496f4 Undo block 102 748223dc39df65a8c88ef9af80f98cbf130a2f8cfdf1900ff84f1bcf1fcc04b2 0 KB - New TOP 103 Current last 0b1c05438c178aa1976b713a0b794d705f955b99236a2bcc9cd8609b68db92bf
GetHeaders 1 up to 0000000000000000000000000000000000000000000000000000000000000000 ? 748223dc39df65a8c88ef9af80f98cbf130a2f8cfdf1900ff84f1bcf1fcc04b2 found: true sending back 0 headers
Isn't it supposed to return the new fork? I don't think so, because 748223dc39df65a8c88ef9af80f98cbf130a2f8cfdf1900ff84f1bcf1fcc04b2 has no children. 748223dc39df65a8c88ef9af80f98cbf130a2f8cfdf1900ff84f1bcf1fcc04b2 is no longer on the main chain, so you're supposed to ignore it and try the next locator. getheaders/getblocks are used by your peers to get the main chain, they don't care about forks.
|
|
|
|
piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 09, 2016, 10:47:59 PM |
|
but there is only one locator in that getheaders request it'd print them all, but there was only one.
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
hhanh00
|
|
April 10, 2016, 02:40:09 AM |
|
In that case, the node is supposed to return headers starting from the genesis block. The relevant code of bitcoin core is in main.cpp (line 4886-) if (locator.IsNull()) { // If locator is null, return the hashStop block BlockMap::iterator mi = mapBlockIndex.find(hashStop); if (mi == mapBlockIndex.end()) return true; pindex = (*mi).second; } else { // Find the last block the caller has in the main chain pindex = FindForkInGlobalIndex(chainActive, locator); if (pindex) pindex = chainActive.Next(pindex); }
...
CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator) { // Find the first block the caller has in the main chain BOOST_FOREACH(const uint256& hash, locator.vHave) { BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) { CBlockIndex* pindex = (*mi).second; if (chain.Contains(pindex)) return pindex; } } return chain.Genesis(); }
I have no clue why there is a different behavior if the locator is null.
|
|
|
|
piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 10, 2016, 08:49:52 AM |
|
OK, if that's what it takes... let move on I did the change in handling getheaders. Now it can stop in two different ways - I will just focus on the first one. Gocoin's debug: Commiting block 66fe0adc6e2043ebd68d0f17cc1b96a5dc8f75dfa5ffa2ec126c8348a8e3ea04 -> 2858fd7dec9ee514ef1c4dd76beb97e91f6513f1b2afe3f6f755c3843607f74f - New TOP 99 Current last 66fe0adc6e2043ebd68d0f17cc1b96a5dc8f75dfa5ffa2ec126c8348a8e3ea04 cmd headers 82 cmd inv 37 got block inv 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 InvBlockOld cmd inv 37 got block inv 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 InvBlockOld cmd block 179 cmd getheaders 69
Commiting block 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 -> 66fe0adc6e2043ebd68d0f17cc1b96a5dc8f75dfa5ffa2ec126c8348a8e3ea04 cmd ping 8 - New TOP 100 Current last 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 cmd headers 82 cmd inv 37 got block inv 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 InvBlockOld cmd inv 37 got block inv 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 InvBlockOld cmd block 323 cmd getheaders 69 cmd ping 8
Commiting block 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 -> 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 cmd headers 82 cmd inv 37 got block inv 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e InvBlockOld cmd block 324 - New TOP 101 Current last 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 cmd inv 37
Commiting block 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e -> 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 got block inv 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e InvBlockOld - New TOP 102 Current last 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e cmd getheaders 69 cmd ping 8 cmd inv 37 got block inv 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e InvBlockOld Tool's debug: 10:39:31 1 BitcoindComparisonTool.main: Testing block Initial Block chain output generation 66fe0adc6e2043ebd68d0f17cc1b96a5dc8f75dfa5ffa2ec126c8348a8e3ea04 10:39:31 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 2858fd7dec9ee514ef1c4dd76beb97e91f6513f1b2afe3f6f755c3843607f74f 10:39:31 17 BitcoindComparisonTool$1.onPreMessageReceived: Sending header (2858fd7dec9ee514ef1c4dd76beb97e91f6513f1b2afe3f6f755c3843607f74f) -> 66fe0adc6e2043ebd68d0f17cc1b96a5dc8f75dfa5ffa2ec126c8348a8e3ea04 10:39:31 1 BitcoindComparisonTool.main: Sent inv with block 66fe0adc6e2043ebd68d0f17cc1b96a5dc8f75dfa5ffa2ec126c8348a8e3ea04 10:39:31 17 BitcoindComparisonTool$1.onPreMessageReceived: Requested 66fe0adc6e2043ebd68d0f17cc1b96a5dc8f75dfa5ffa2ec126c8348a8e3ea04 10:39:31 17 BitcoindComparisonTool$1.onPreMessageReceived: Got header from bitcoind 66fe0adc6e2043ebd68d0f17cc1b96a5dc8f75dfa5ffa2ec126c8348a8e3ea04 10:39:31 1 BitcoindComparisonTool.main: Block "Initial Block chain output generation" completed processing 10:39:31 1 BitcoindComparisonTool.main: Testing block Initial Block chain output generation 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 10:39:31 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 66fe0adc6e2043ebd68d0f17cc1b96a5dc8f75dfa5ffa2ec126c8348a8e3ea04 10:39:31 17 BitcoindComparisonTool$1.onPreMessageReceived: Sending header (66fe0adc6e2043ebd68d0f17cc1b96a5dc8f75dfa5ffa2ec126c8348a8e3ea04) -> 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 10:39:31 1 BitcoindComparisonTool.main: Sent inv with block 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Requested 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Got header from bitcoind 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 10:39:32 1 BitcoindComparisonTool.main: Block "Initial Block chain output generation" completed processing
10:39:32 1 BitcoindComparisonTool.main: Testing block b1 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Sending header (4aa43a46282751bf1a875bfc0c3a8c05da948736253f87e9846a556bf7588d93) -> 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 10:39:32 1 BitcoindComparisonTool.main: Sent inv with block 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Requested 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Got header from bitcoind 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 10:39:32 1 BitcoindComparisonTool.main: Block "b1" completed processing
10:39:32 1 BitcoindComparisonTool.main: Testing block b2 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Sending header (1fd4823e456bb6bb9bcc757c67ec3456dee4bc6119eea94f09ff24a2afd8c1c5) -> 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Requested 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:32 1 BitcoindComparisonTool.main: Sent inv with block 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Got header from bitcoind 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:32 1 BitcoindComparisonTool.main: Block "b2" completed processing 10:39:32 1 BitcoindComparisonTool.main: Testing block b2 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:32 1 AbstractBlockChain.add: 6 blocks per second 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:32 1 BitcoindComparisonTool.main: Sent inv with block 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:32 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:33 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:33 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:33 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:33 1 BitcoindComparisonTool.main: bitcoind still hasn't requested block b2 with hash 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:33 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:33 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:34 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:34 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:34 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:34 1 BitcoindComparisonTool.main: bitcoind still hasn't requested block b2 with hash 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:34 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:34 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:35 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:35 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:35 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:35 1 BitcoindComparisonTool.main: bitcoind still hasn't requested block b2 with hash 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:35 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:35 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:36 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:36 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:36 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:36 1 BitcoindComparisonTool.main: bitcoind still hasn't requested block b2 with hash 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:36 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:36 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:37 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:37 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:37 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:37 1 BitcoindComparisonTool.main: bitcoind still hasn't requested block b2 with hash 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:37 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:37 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:38 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:38 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:38 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:38 1 BitcoindComparisonTool.main: bitcoind still hasn't requested block b2 with hash 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:38 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:38 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:39 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:39 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:39 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:39 1 BitcoindComparisonTool.main: bitcoind still hasn't requested block b2 with hash 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:39 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e 10:39:39 17 BitcoindComparisonTool$1.onPreMessageReceived: Found header 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e
It gets stuck in a loop like this. Basically what is happening: *) I receive "header" with "b2" (797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e) and I issue "getdata" for it *) I receive "inv" for "b2" - 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e and ignore it (as the block is being downloaded) *) I receive "block" for 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e *) I process the block and accept it as the new head: Current last 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e*) I receive "inv" for "b2" - 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e and ignore it (as the block is already known) *) The tool gets stuck in the loop, printing: bitcoind still hasn't requested block b2 with hash 797f9966e1d76b53b41167e4d05134f9216da0b941feed3578f1a446bdc9828e
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
Colt22
|
|
April 10, 2016, 09:30:12 AM |
|
nice old wallet... from 2013 it means is a stable one?
|
|
|
|
piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 10, 2016, 09:33:19 AM |
|
nice old wallet... from 2013 it means is a stable one? Most of the tags are stable See by yourself.
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 10, 2016, 09:51:35 AM |
|
OK, if that's what it takes... let move on
I did the change in handling getheaders. Now it can stop in two different ways - I will just focus on the first one. When I add some delays, here and there, I can work around this first issue, so let's fast forward.. I changed the behaviour of "getheaders" - now it gets blocks from the genesis when locator isn't found. Still the end result is similar to what I had before. It report error after "b4" and "b5" and terminates after "b8". test tool: http://pastebin.com/YpkHJMeWgocoin: http://pastebin.com/QdUCHZrHI honestly don't know what is its problem with b4 - I think the branch is swapped just as it should be. I believe the issues I'm experiencing are not related to the consensus rules, but only to the network protocol's behaviour.
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
hhanh00
|
|
April 10, 2016, 09:57:55 AM |
|
The tool uses an ugly hack to work around timing issues. Bitcoind processes commands in sequence so the tool sends a ping and waits for a pong. At that time bitcoind has finished processing previous commands and reorgs have taken place. This won't work if your implementation handles ping/pong in parallel.
The pastbins are truncated. Actually the first 100 blocks are not interesting. You could edit that part out.
|
|
|
|
piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 10, 2016, 10:08:55 AM |
|
Thank you. That's very useful information. I guess I can somehow imitate it, for a purpose of the test. I's also sending empty invs - I'm assuming this is also supposed to serve some purpose.. Either way, I think now my biggest mistery is what it doesn't like about the "b4" test tool: http://pastebin.com/YpkHJMeWgocoin: http://pastebin.com/QdUCHZrH
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 10, 2016, 10:16:05 AM |
|
Do you know if it is possible to just make this tool output the sequence of blocks and do not talk to my node at the network?
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
hhanh00
|
|
April 10, 2016, 10:24:37 AM |
|
It creates such a file every time your run it. That's why it takes a while to startup. File blockFile = File.createTempFile("testBlocks", ".dat"); blockFile.deleteOnExit();
Change these lines and you can keep the file around.
|
|
|
|
hhanh00
|
|
April 10, 2016, 10:25:28 AM |
|
The pastbins are truncated. Actually the first 100 blocks are not interesting. You could edit that part out.
|
|
|
|
piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 10, 2016, 10:30:17 AM |
|
The pastbins are truncated. Actually the first 100 blocks are not interesting. You could edit that part out.
Sorry - haven't noticed. Thanks, I find the blocks file - will try to feed it to node and see... Think it's an easier approach, as achieving network compatibility with this tool is not my goal. But I want to get the block consensus tests out of it.
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
hhanh00
|
|
April 10, 2016, 12:53:10 PM |
|
Ok. It's a bit tricky because the block file doesn't have the expected state of the blockchain, just the block data. In a previous project, I actually did the same thing. You may want to take a look at https://github.com/hhanh00/bitcoin-akka-tutorialI patched the test generator so that it writes out the chain state and hook up a test driver.
|
|
|
|
piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 10, 2016, 02:46:07 PM |
|
It's a bit tricky because the block file doesn't have the expected state of the blockchain, just the block data. Yes, I know. I have been testing it manually, going down the source code. The code says whether a specific block is expected bo be accepted or rejected (the second parameter to BlockAndValidity) At this moment all up to block #55 is OK. Then there are some timestamp tests and things get complicated.. But so far so good. Cheers
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
piotr_n (OP)
Legendary
Offline
Activity: 2055
Merit: 1359
aka tonikt
|
|
April 11, 2016, 10:55:52 AM |
|
OK... After a several changes in Gocoin, currently it does everything up till (including) b89.
Two blocks do not return the expected result:
b48 - block with the time stamp more than 2 hours in the future. I cannot properly against the blocks data from the disk, but I trust I didn't screw up this check.
b61 - same ID of a coinbase TX. I'm not going to be adding a check for this, as it can only happen with v1 bocks, which are long gone.
In a future, when I find some more time, I will try to somehow fix the tests tool; make it stable and test all my further gocoin releases against it. Will also do the remaining "massive reorgs" tests...
Thank you once again, @hhanh00 - I really appreciate your input. It helped me to find (and fix) another few compatibility issues, on the blocks checking. Some of the checks in Gocoin were too strict (e.g. b64), others (e.g. b66) were not strict enough.
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
hhanh00
|
|
April 11, 2016, 02:27:03 PM |
|
No problem, you're welcome.
|
|
|
|
|