tx.unsigned: new sign() method
This commit is contained in:
parent
b5c4b134c9
commit
dab9d6bda9
3 changed files with 14 additions and 14 deletions
|
|
@ -21,13 +21,7 @@ class Unsigned(Completed, TxBase.Unsigned):
|
|||
desc = 'unsigned transaction'
|
||||
|
||||
# Return signed object or False. Don’t exit or raise exception:
|
||||
async def sign(self, keys, tx_num_str=''):
|
||||
|
||||
from ....exception import TransactionChainMismatch
|
||||
try:
|
||||
self.check_correct_chain()
|
||||
except TransactionChainMismatch:
|
||||
return False
|
||||
async def proto_sign(self, keys, tx_num_str=''):
|
||||
|
||||
if (self.has_segwit_inputs() or self.has_segwit_outputs()) and not self.proto.cap('segwit'):
|
||||
ymsg(f"TX has Segwit inputs or outputs, but {self.coin} doesn't support Segwit!")
|
||||
|
|
|
|||
|
|
@ -18,13 +18,7 @@ class Unsigned:
|
|||
desc = 'unsigned transaction'
|
||||
|
||||
# Return signed object or False. Don’t exit or raise exception:
|
||||
async def sign(self, keys, tx_num_str=''):
|
||||
|
||||
from ....exception import TransactionChainMismatch
|
||||
try:
|
||||
self.check_correct_chain()
|
||||
except TransactionChainMismatch:
|
||||
return False
|
||||
async def proto_sign(self, keys, tx_num_str=''):
|
||||
|
||||
o = self.txobj
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,18 @@ class Unsigned(Completed):
|
|||
ext = 'rawtx'
|
||||
automount = False
|
||||
|
||||
# Return signed object or False. Don’t exit or raise exception, unless fatal:
|
||||
async def sign(self, keys, tx_num_str=''):
|
||||
|
||||
try:
|
||||
self.check_correct_chain()
|
||||
except Exception as e:
|
||||
if type(e).__name__ == 'TransactionChainMismatch':
|
||||
return False
|
||||
raise # fatal
|
||||
|
||||
return await self.proto_sign(keys, tx_num_str=tx_num_str)
|
||||
|
||||
def delete_attrs(self, desc, attr):
|
||||
for e in getattr(self, desc):
|
||||
if hasattr(e, attr):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue