From 57b948c7a1fb48fcdbb80b59b7ba6e6d52326451 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sun, 24 Apr 2022 15:36:42 -0300 Subject: [PATCH] self.log prints to stderr. --- main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index ef621bf..1b6daee 100755 --- a/main.py +++ b/main.py @@ -35,6 +35,7 @@ ./main.py to-cold $TXID """ +import sys import struct import hashlib import sys @@ -79,6 +80,10 @@ BLANK_INPUT = CMutableTxIn +def no_output(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + + @dataclass(frozen=True) class Coin: outpoint: COutPoint @@ -104,6 +109,8 @@ class Wallet: coins: t.List[Coin] network: str + log: t.Callable = no_output + @classmethod def generate(cls, seed: bytes, network: str = "regtest") -> "Wallet": return cls( @@ -455,10 +462,6 @@ def t_(b: t.Union[bytes, t.Any]) -> str: bold = make_color(esc(1), esc(22)) -def no_output(*args, **kwargs): - pass - - @dataclass class VaultExecutor: plan: VaultPlan