diff options
author | zelig <viktor.tron@gmail.com> | 2015-04-08 10:34:20 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-04-09 20:58:35 +0800 |
commit | f546b486bf444d9601cf97b934b2974a9b4d58f8 (patch) | |
tree | 17d53a2c6719d7c147854197fb25d3d2a01b5525 /blockpool/peers_test.go | |
parent | 42fb9652f56321d2752ffe7773806df11f3087b8 (diff) | |
download | go-tangerine-f546b486bf444d9601cf97b934b2974a9b4d58f8.tar.gz go-tangerine-f546b486bf444d9601cf97b934b2974a9b4d58f8.tar.zst go-tangerine-f546b486bf444d9601cf97b934b2974a9b4d58f8.zip |
introduce peers registry on nodes
- TestPeerPromotionByTdOnBlock renamed and skipped for now test should pass iff
if TD is updated based on an agreement
- senders register in AddBlock, flag records if they are coming from newblock
message (and therefore advertise their TD with the block) or block message
(TODO: latter are stored on the cache and updated by checkTD call;
protocol should also call AddBlock on newblock messages by non-best peers)
- remove TD update from optional TD field in addBlock: this is no longer part of
the eth protocol spec -> TODO: reflect in wiki
- only initialise peer map if at least two
Diffstat (limited to 'blockpool/peers_test.go')
-rw-r--r-- | blockpool/peers_test.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/blockpool/peers_test.go b/blockpool/peers_test.go index 62e059337..e32bb6fc8 100644 --- a/blockpool/peers_test.go +++ b/blockpool/peers_test.go @@ -144,7 +144,8 @@ func TestAddPeer(t *testing.T) { blockPool.Stop() } -func TestPeerPromotionByOptionalTdOnBlock(t *testing.T) { +func TestPeerPromotionByTdOnBlock(t *testing.T) { + t.Skip() test.LogInit() _, blockPool, blockPoolTester := newTestBlockPool(t) blockPoolTester.blockChain[0] = nil @@ -168,13 +169,8 @@ func TestPeerPromotionByOptionalTdOnBlock(t *testing.T) { best = peer2.AddPeer() peer2.serveBlocks(3, 4) peer2.serveBlockHashes(4, 3, 2, 1) - hashes := blockPoolTester.hashPool.IndexesToHashes([]int{2, 3}) - peer1.waitBlocksRequests(3) - blockPool.AddBlock(&types.Block{ - HeaderHash: common.Hash(hashes[1]), - ParentHeaderHash: common.Hash(hashes[0]), - Td: common.Big3, - }, "peer1") + // hashes := blockPoolTester.hashPool.IndexesToHashes([]int{2, 3}) + peer1.serveBlocks(2, 3) blockPool.RemovePeer("peer2") if blockPool.peers.best.id != "peer1" { |