Skip to content

Instantly share code, notes, and snippets.

@dnldd
Last active February 14, 2018 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnldd/2319c166d3cfbffcc6ee5a4d2492123d to your computer and use it in GitHub Desktop.
Save dnldd/2319c166d3cfbffcc6ee5a4d2492123d to your computer and use it in GitHub Desktop.
hasExpiry update
// Iterate through all unmined credits and update stored serializations
unminedCreditsBucket := txmgrBucket.NestedReadWriteBucket(bucketUnminedCredits)
unminedCursor := unminedCreditsBucket.ReadWriteCursor()
for k, v := unminedCursor.First(); v != nil; k, v = unminedCursor.Next() {
vCpy := make([]byte, len(v))
copy(vCpy, v)
hash, err := chainhash.NewHash(extractRawUnminedCreditTxHash(k))
if err != nil {
return err
}
recV := existsRawUnmined(txmgrBucket, hash[:])
record := &TxRecord{}
err = readRawTxRecord(hash, recV, record)
if err != nil {
return err
}
// set the hasexpiry flag if the tx has an expiry value set
if record.MsgTx.Expiry != wire.NoExpiryValue {
vCpy[8] |= 1 << 4
err = unminedCreditsBucket.Put(k, vCpy)
if err != nil {
return err
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment