Skip to content

Commit

Permalink
Fix offline signed tx deser
Browse files Browse the repository at this point in the history
Fix change address detection
  • Loading branch information
goatpig committed Mar 31, 2017
1 parent 1dadf3f commit fae3156
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 2 additions & 7 deletions armoryengine/Transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions ui/TxFrames.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit fae3156

Please sign in to comment.