func DeleteTxnFromDisk(rwtxn *mdbs.RWTxn, txnId *common.TxnId) error { bites, err := rwtxn.Get(DB.TransactionRefs, txnId[:]) switch err { case nil: if count := binary.BigEndian.Uint32(bites) - 1; count == 0 { // fmt.Printf("%v -Refcount now 0\n", txnId) if err = rwtxn.Del(DB.TransactionRefs, txnId[:], nil); err != nil { return err } return rwtxn.Del(DB.Transactions, txnId[:], nil) } else { // fmt.Printf("%v -Refcount now %v\n", txnId, count) binary.BigEndian.PutUint32(bites, count) return rwtxn.Put(DB.TransactionRefs, txnId[:], bites, 0) } case mdb.NotFound: return nil default: return err } }