def set_spent(self, addr, txi, txid, index, height, undo): key = self.address_to_key(addr) leaf = key + txi s = self.delete_key(leaf) value = bytes8_to_int(s[0:8]) in_height = bytes4_to_int(s[8:12]) undo[leaf] = value, in_height # delete backlink txi-> addr self.db_addr.delete(txi) # add to history s = self.db_hist.get(addr) if s is None: s = '' txo = (txid + int_to_hex4(index) + int_to_hex4(height)).decode('hex') s += txi + int_to_bytes4(in_height) + txo s = s[-80 * self.pruning_limit:] self.db_hist.put(addr, s)
def set_spent(self, addr, txi, txid, index, height, undo): key = self.address_to_key(addr) leaf = key + txi s = self.delete_key(leaf) value = bytes8_to_int(s[0:8]) in_height = bytes4_to_int(s[8:12]) undo[leaf] = value, in_height # delete backlink txi-> addr self.db_addr.delete(txi) # add to history s = self.db_hist.get(addr) if s is None: s = '' txo = (txid + int_to_hex4(index) + int_to_hex4(height)).decode('hex') s += txi + int_to_bytes4(in_height) + txo s = s[ -80*self.pruning_limit:] self.db_hist.put(addr, s)