fix nil witness crash; sync's now on segnet

This commit is contained in:
Tadge Dryja 2016-02-14 12:50:20 -08:00
parent ee4dd8aaa0
commit a955a428a7
4 changed files with 11 additions and 10 deletions

View File

@ -68,11 +68,11 @@ func shell() {
} }
} }
// once we're connected, initiate headers sync // once we're connected, initiate headers sync
// err = SCon.AskForHeaders() err = SCon.AskForHeaders()
// if err != nil { if err != nil {
// log.Fatal(err) log.Fatal(err)
// } }
// main shell loop // main shell loop
for { for {

View File

@ -349,7 +349,7 @@ func (s *SPVCon) AskForBlocks() error {
return nil return nil
} }
fmt.Printf("will request merkleblocks %d to %d\n", dbTip, headerTip) fmt.Printf("will request blocks %d to %d\n", dbTip, headerTip)
if !s.HardMode { // don't send this in hardmode! that's the whole point if !s.HardMode { // don't send this in hardmode! that's the whole point
// create initial filter // create initial filter

View File

@ -39,7 +39,7 @@ func (s *SPVCon) IngestBlock(m *wire.MsgBlock) {
for i, tx := range m.Transactions { for i, tx := range m.Transactions {
// if i > 0 { // if i > 0 {
fmt.Printf("wtxid: %s\n", tx.WTxSha()) fmt.Printf("wtxid: %s\n", tx.WTxSha())
fmt.Printf("txid: %s\n", tx.TxSha()) fmt.Printf(" txid: %s\n", tx.TxSha())
fmt.Printf("%d %s", i, TxToString(tx)) fmt.Printf("%d %s", i, TxToString(tx))
// } // }
} }

View File

@ -133,8 +133,9 @@ func CheckDoubleSpends(
// TxToString prints out some info about a transaction. for testing / debugging // TxToString prints out some info about a transaction. for testing / debugging
func TxToString(tx *wire.MsgTx) string { func TxToString(tx *wire.MsgTx) string {
str := fmt.Sprintf("\t size %d wsize %d Tx %s\n", str := fmt.Sprintf("\t size %d vsize %d wsize %d Tx %s\n",
tx.SerializeSize(), tx.SerializeSizeWitness(), tx.TxSha().String()) tx.SerializeSize(), tx.VirtualSize(), tx.SerializeSizeWitness(),
tx.TxSha().String())
for i, in := range tx.TxIn { for i, in := range tx.TxIn {
str += fmt.Sprintf("Input %d: %s\n", i, in.PreviousOutPoint.String()) str += fmt.Sprintf("Input %d: %s\n", i, in.PreviousOutPoint.String())
str += fmt.Sprintf("SigScript for input %d: %x\n", i, in.SignatureScript) str += fmt.Sprintf("SigScript for input %d: %x\n", i, in.SignatureScript)
@ -148,7 +149,7 @@ func TxToString(tx *wire.MsgTx) string {
} }
} }
for i, wit := range tx.TxWitness { for i, wit := range tx.TxWitness {
if wit.ScriptWitness != nil { if wit != nil {
str += fmt.Sprintf("Witness %d: %x\n", i, wit.ScriptWitness) str += fmt.Sprintf("Witness %d: %x\n", i, wit.ScriptWitness)
} }
} }