diff --git a/shell.go b/shell.go index 9438e7de..3654cf72 100644 --- a/shell.go +++ b/shell.go @@ -25,15 +25,15 @@ testing. It can send and receive coins. const ( keyFileName = "testkey.hex" headerFileName = "headers.bin" - dbFileName = "/dev/shm/utxo.db" + dbFileName = "utxo.db" // this is my local testnet node, replace it with your own close by. // Random internet testnet nodes usually work but sometimes don't, so // maybe I should test against different versions out there. - SPVHostAdr = "127.0.0.1:18333" + SPVHostAdr = "127.0.0.1:28333" ) var ( - Params = &chaincfg.TestNet3Params + Params = &chaincfg.SegNetParams SCon uspv.SPVCon // global here for now ) @@ -51,7 +51,7 @@ func shell() { // setup spvCon SCon, err = uspv.OpenSPV( - SPVHostAdr, headerFileName, dbFileName, &Store, false, false, Params) + SPVHostAdr, headerFileName, dbFileName, &Store, true, false, Params) if err != nil { log.Fatal(err) } @@ -61,7 +61,7 @@ func shell() { log.Fatal(err) } if tip == 0 { // DB has never been used, set to birthday - tip = 675000 // hardcoded; later base on keyfile date? + tip = 1234 // hardcoded; later base on keyfile date? err = SCon.TS.SetDBSyncHeight(tip) if err != nil { log.Fatal(err) diff --git a/uspv/eight333.go b/uspv/eight333.go index 3c40f2c2..180d3767 100644 --- a/uspv/eight333.go +++ b/uspv/eight333.go @@ -15,7 +15,8 @@ const ( headerFileName = "headers.bin" // version hardcoded for now, probably ok...? - VERSION = 70011 + // 70012 is for segnet... make this a init var? + VERSION = 70012 ) type SPVCon struct { @@ -115,7 +116,9 @@ func (s *SPVCon) IngestMerkleBlock(m *wire.MsgMerkleBlock) { // into our SPV header file newMerkBlockSha := m.Header.BlockSha() if !hah.blockhash.IsEqual(&newMerkBlockSha) { - log.Printf("merkle block out of order error") + log.Printf("merkle block out of order got %s expect %s", + m.Header.BlockSha().String(), hah.blockhash.String()) + log.Printf("has %d hashes", len(m.Hashes)) return } diff --git a/uspv/msghandler.go b/uspv/msghandler.go index 06d10c4a..c3def1fb 100644 --- a/uspv/msghandler.go +++ b/uspv/msghandler.go @@ -128,7 +128,7 @@ func (s *SPVCon) TxHandler(m *wire.MsgTx) { height, ok := s.TS.OKTxids[m.TxSha()] s.TS.OKMutex.Unlock() if !ok { - log.Printf("Tx %s unknown, will not ingest\n") + log.Printf("Tx %s unknown, will not ingest\n", m.TxSha().String()) return }