implement hard mode

seems to work OK.  Could be sped up by local filters instead of
ingesting every tx from the block but I can do that later if
performance (mostly disk i/o) is an issue

once multiple connections are implemented, hard mode should forward
txs to blend in.
This commit is contained in:
Tadge Dryja committed 2016-02-06 22:48:54 -08:00
1 parent 8518be13f7
commit 4535b965cd
5 files changed
+94 -49

No files matched your search

+3 -3
View File
@@ -13,10 +13,10 @@ import (
// OpenPV starts a
func OpenSPV(remoteNode string, hfn, dbfn string,
inTs *TxStore, p *chaincfg.Params) (SPVCon, error) {
inTs *TxStore, hard bool, p *chaincfg.Params) (SPVCon, error) {
// create new SPVCon
var s SPVCon
s.HardMode = hard
// I should really merge SPVCon and TxStore, they're basically the same
inTs.Param = p
s.TS = inTs // copy pointer of txstore into spvcon
@@ -83,7 +83,7 @@ func OpenSPV(remoteNode string, hfn, dbfn string,
go s.incomingMessageHandler()
s.outMsgQueue = make(chan wire.Message)
go s.outgoingMessageHandler()
s.mBlockQueue = make(chan HashAndHeight, 32) // queue depth 32 is a thing
s.blockQueue = make(chan HashAndHeight, 32) // queue depth 32 is a thing
s.fPositives = make(chan int32, 4000) // a block full, approx
s.inWaitState = make(chan bool, 1)
go s.fPositiveHandler()