From fae3156d6774e0c2ca27bfb223a4ae6854f8c8be Mon Sep 17 00:00:00 2001 From: goatpig Date: Fri, 31 Mar 2017 03:01:30 +0200 Subject: [PATCH] Fix offline signed tx deser Fix change address detection --- armoryengine/Transaction.py | 9 ++------- ui/TxFrames.py | 4 ++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/armoryengine/Transaction.py b/armoryengine/Transaction.py index 5c779ef8d..061011435 100644 --- a/armoryengine/Transaction.py +++ b/armoryengine/Transaction.py @@ -1618,16 +1618,14 @@ def unserialize(self, rawBinaryData, skipMagicCheck=False): seq = bu.get(UINT32) nEntry = bu.get(VAR_INT) - keysiginfo = [] pubMap, sigList, locList = {},[],[] for i in range(nEntry): pub = bu.get(VAR_STR) sigList.append([i, bu.get(VAR_STR)]) locList.append([i, bu.get(VAR_STR)]) - if p2shScr == None: - scrAddr = SCRADDR_P2PKH_BYTE+hash160(pub) - + if p2shScr == None or len(p2shScr) == 0: + scrAddr = ADDRBYTE+hash160(pub) else: scrAddr = P2SHBYTE+hash160(p2shScr) pubMap[scrAddr] = pub @@ -1636,9 +1634,6 @@ def unserialize(self, rawBinaryData, skipMagicCheck=False): if not outpt[:32] == hash256(suppTx): raise UnserializeError('OutPoint hash does not match supporting tx') - if not seq==UINT32_MAX: - LOGWARN('WARNING: NON-MAX SEQUENCE NUMBER ON UNSIGNEDTX INPUT!') - if not magic==MAGIC_BYTES and not skipMagicCheck: LOGERROR('WRONG NETWORK!') LOGERROR(' MAGIC BYTES: ' + magic) diff --git a/ui/TxFrames.py b/ui/TxFrames.py index 8845a1df3..43954bcf5 100644 --- a/ui/TxFrames.py +++ b/ui/TxFrames.py @@ -1719,6 +1719,10 @@ def signTx(self): addrStr = script_to_addrStr(script) if self.wlt.hasAddr(addrStr_to_hash160(addrStr)[1]): svpairsMine.append([script, value]) + elif scrType == CPP_TXOUT_P2SH: + addrStr = script_to_addrStr(script) + if self.wlt.hasScrAddr(addrStr_to_hash160(addrStr)[1]): + svpairsMine.append([script, value]) if len(svpairsMine) == 0 and len(svpairs) > 1: QMessageBox.warning(self, self.tr('Missing Change'), self.tr(