Fix estimate minning fee on testnet

This commit is contained in:
Reckless_Satoshi 2023-10-27 09:34:20 -07:00
parent 951b0abac3
commit 1ecd1ec7dc
No known key found for this signature in database
GPG Key ID: 9C4585B561315571

View File

@ -71,6 +71,8 @@ class LNDNode:
5: "Insufficient local balance.",
}
is_testnet = lightningstub.GetInfo(lnrpc.GetInfoRequest()).testnet
@classmethod
def get_version(cls):
try:
@ -92,9 +94,14 @@ class LNDNode:
def estimate_fee(cls, amount_sats, target_conf=2, min_confs=1):
"""Returns estimated fee for onchain payouts"""
if cls.is_testnet:
dummy_address = "tb1qehyqhruxwl2p5pt52k6nxj4v8wwc3f3pg7377x"
else:
dummy_address = "bc1qgxwaqe4m9mypd7ltww53yv3lyxhcfnhzzvy5j3"
# We assume segwit. Use hardcoded address as shortcut so there is no need of user inputs yet.
request = lnrpc.EstimateFeeRequest(
AddrToAmount={"bc1qgxwaqe4m9mypd7ltww53yv3lyxhcfnhzzvy5j3": amount_sats},
AddrToAmount={dummy_address: amount_sats},
target_conf=target_conf,
min_confs=min_confs,
spend_unconfirmed=False,