Skip to content

Commit

Permalink
send to many fix
Browse files Browse the repository at this point in the history
  • Loading branch information
goatpig committed Mar 31, 2014
1 parent 6ff5061 commit 2449121
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 57 deletions.
2 changes: 1 addition & 1 deletion armoryengine/PyBtcWallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def syncWithBlockchainLite(self, startBlk=None):
TheBDM.scanRegisteredTxForWallet(self.cppWallet, startBlk, wait=True)
self.lastSyncBlockNum = TheBDM.getTopBlockHeight(wait=True)

wltLE = self.cppWallet.getTxLedger()
wltLE = self.cppWallet.getTxLedgerForComments()
for le in wltLE:
txHash = le.getTxHash()
if not self.txAddrMap.has_key(txHash):
Expand Down
67 changes: 17 additions & 50 deletions cppForSwig/BlockUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,8 @@ void BtcWallet::scanTx(Tx & tx,
false); // "isChangeBack" is meaningless for TxIn
thisAddrPtr->addLedgerEntry(newEntry, isZeroConf);

txLedgerForComments_.push_back(newEntry);

// Update last seen on the network
thisAddrPtr->setLastTimestamp(txtime);
thisAddrPtr->setLastBlockNum(blknum);
Expand Down Expand Up @@ -1226,6 +1228,8 @@ void BtcWallet::scanTx(Tx & tx,
false, // sentToSelf meaningless for addr ledger
false); // we don't actually know
thisAddrPtr->addLedgerEntry(newLedger, isZeroConf);

txLedgerForComments_.push_back(newLedger);
}
// Check if this is the first time we've seen this
if(thisAddrPtr->getFirstTimestamp() == 0)
Expand All @@ -1242,21 +1246,10 @@ void BtcWallet::scanTx(Tx & tx,

bool allTxOutIsOurs = true;
bool anyTxOutIsOurs = false;
vector<BinaryData> scrAddrV;
for(uint32_t i=0; i<tx.getNumTxOut(); i++)
{
if( thisTxOutIsOurs[i] )
{
anyTxOutIsOurs = true;
if(!mainwallet)
{
TxOut txout = tx.getTxOutCopy(i);
if( txout.getScriptType() != TXOUT_SCRIPT_NONSTANDARD )
if(std::find(scrAddrV.begin(),
scrAddrV.end(), txout.getScrAddressStr()) == scrAddrV.end())
scrAddrV.push_back(txout.getScrAddressStr());
}
}
else
allTxOutIsOurs = false;
}
Expand All @@ -1266,46 +1259,20 @@ void BtcWallet::scanTx(Tx & tx,

if((anyNewTxInIsOurs || anyNewTxOutIsOurs))
{
if(mainwallet)
{
LedgerEntry le( BinaryData(0),
totalLedgerAmt,
blknum,
tx.getThisHash(),
txIndex,
txtime,
isCoinbaseTx,
isSentToSelf,
isChangeBack);

if(isZeroConf)
ledgerAllAddrZC_.push_back(le);
else
ledgerAllAddr_.push_back(le);
}
else
{
vector<BinaryData>::iterator saIt;
for(saIt = scrAddrV.begin(); saIt != scrAddrV.end(); saIt++)
{
LedgerEntry le( (*saIt),
totalLedgerAmt,
blknum,
tx.getThisHash(),
txIndex,
txtime,
isCoinbaseTx,
isSentToSelf,
isChangeBack);

if(isZeroConf)
ledgerAllAddrZC_.push_back(le);
else
ledgerAllAddr_.push_back(le);
LedgerEntry le( BinaryData(0),
totalLedgerAmt,
blknum,
tx.getThisHash(),
txIndex,
txtime,
isCoinbaseTx,
isSentToSelf,
isChangeBack);

if(isSentToSelf) break;
}
}
if(isZeroConf)
ledgerAllAddrZC_.push_back(le);
else
ledgerAllAddr_.push_back(le);
}
}

Expand Down
9 changes: 8 additions & 1 deletion cppForSwig/BlockUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ class BtcWallet
map<OutPoint, TxIOPair> & getTxIOMap(void) {return txioMap_;}
map<OutPoint, TxIOPair> & getNonStdTxIO(void) {return nonStdTxioMap_;}


vector<LedgerEntry> & getTxLedgerForComments(void)
{ return txLedgerForComments_; }

bool isOutPointMine(BinaryData const & hsh, uint32_t idx);

void pprintLedger(void);
Expand All @@ -455,7 +459,10 @@ class BtcWallet
map<OutPoint, TxIOPair> txioMap_;

vector<LedgerEntry> ledgerAllAddr_;
vector<LedgerEntry> ledgerAllAddrZC_;
vector<LedgerEntry> ledgerAllAddrZC_;

// Work around for address comments populating until 1:1 wallets are adopted
vector<LedgerEntry> txLedgerForComments_;

// For non-std transactions
map<OutPoint, TxIOPair> nonStdTxioMap_;
Expand Down
10 changes: 5 additions & 5 deletions ui/TxFrames.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def validateInputsGetTxDP(self):
scraddr = addrStr_to_scrAddr(recipStr)

scraddrValuePairs.append((scraddr, value))
self.comments.append(str(self.widgetTable[i][COLS.Comm].text()))
self.comments.append((str(self.widgetTable[i][COLS.Comm].text()), value))

try:
feeStr = str(self.edtFeeAmt.text())
Expand Down Expand Up @@ -626,12 +626,12 @@ def createTxAndBroadcast(self):

commentStr = ''
if len(self.comments) == 1:
commentStr = self.comments[0]
commentStr = self.comments[0][0]
else:
for i in range(len(self.comments)):
amt = self.origRVPairs[i][1]
if len(self.comments[i].strip()) > 0:
commentStr += '%s (%s); ' % (self.comments[i], coin2str_approx(amt).strip())
amt = self.comments[i][1]
if len(self.comments[i][0].strip()) > 0:
commentStr += '%s (%s); ' % (self.comments[i][0], coin2str_approx(amt).strip())


tx = self.wlt.signTxDistProposal(txdp)
Expand Down

0 comments on commit 2449121

Please sign in to comment.