Add OP_RETURN support for heirs
Allow heirs to produce an OP_RETURN output instead of a regular BTC payment. An address prefixed with OP_RETURN: carries hex data (max 80 bytes); such heirs always have amount 0 and are excluded from amount calculations. GUI dialog shows a message field with the decoded text, the heir list displays the decoded message, and the OP_RETURN output is emitted with zero value in inheritance transactions.
This commit is contained in:
@@ -157,7 +157,17 @@ class HeirListWidget(MyTreeView, MessageBoxMixin):
|
||||
heir = self.bal_window.heirs[key]
|
||||
labels = [""] * len(self.Columns)
|
||||
labels[self.Columns.NAME] = key
|
||||
labels[self.Columns.ADDRESS] = heir[0]
|
||||
if is_op_return_address(heir[0]):
|
||||
data_hex = heir[0][len(OP_RETURN_PREFIX):]
|
||||
try:
|
||||
decoded = bytes.fromhex(data_hex).decode("utf-8", errors="replace")
|
||||
if len(decoded) > 40:
|
||||
decoded = decoded[:40] + "\u2026"
|
||||
labels[self.Columns.ADDRESS] = decoded
|
||||
except Exception:
|
||||
labels[self.Columns.ADDRESS] = "OP_RETURN"
|
||||
else:
|
||||
labels[self.Columns.ADDRESS] = heir[0]
|
||||
labels[self.Columns.AMOUNT] = Util.decode_amount(
|
||||
heir[1], self.decimal_point
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user