mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Work to fix the transaction source sequence buglet.
This commit is contained in:
@@ -271,7 +271,9 @@ Ledger::pointer Ledger::closeLedger(uint64 timeStamp)
|
|||||||
|
|
||||||
void LocalAccount::syncLedger(const uint160& acctID)
|
void LocalAccount::syncLedger(const uint160& acctID)
|
||||||
{
|
{
|
||||||
setLedgerBalance(theApp->getMasterLedger().getBalance(acctID));
|
AccountState::pointer as=theApp->getMasterLedger().getAccountState(acctID);
|
||||||
|
if(!as) setLedgerBalance(0);
|
||||||
|
else syncLedger(as->getBalance(), as->getSeq());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Ledger::unitTest()
|
bool Ledger::unitTest()
|
||||||
|
|||||||
@@ -44,7 +44,12 @@ public:
|
|||||||
int64 getEffectiveBalance() const { return static_cast<int64_t>(mLgrBalance)+mTxnDelta; }
|
int64 getEffectiveBalance() const { return static_cast<int64_t>(mLgrBalance)+mTxnDelta; }
|
||||||
void credit(uint64 amount) { mTxnDelta+=amount; }
|
void credit(uint64 amount) { mTxnDelta+=amount; }
|
||||||
void debit(uint64 amount) { mTxnDelta-=amount; }
|
void debit(uint64 amount) { mTxnDelta-=amount; }
|
||||||
void setLedgerBalance(uint64_t lb) { mLgrBalance=lb; }
|
void setLedgerBalance(uint64_t lb) { mLgrBalance=lb; if(mTxnSeq==0) mTxnSeq=1; }
|
||||||
|
void syncLedger(uint64_t lb, uint32 sq)
|
||||||
|
{
|
||||||
|
mLgrBalance=lb;
|
||||||
|
if(mTxnSeq<sq) mTxnSeq=sq;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class LocalAccountFamily
|
class LocalAccountFamily
|
||||||
@@ -121,6 +126,7 @@ public:
|
|||||||
uint32 getAcctSeq() const;
|
uint32 getAcctSeq() const;
|
||||||
uint64 getBalance() const;
|
uint64 getBalance() const;
|
||||||
void setLedgerBalance(uint64_t ledgerBalance);
|
void setLedgerBalance(uint64_t ledgerBalance);
|
||||||
|
void syncLedger(uint64_t ledgerBalance, uint32_t ledgerSeq);
|
||||||
void incAcctSeq(uint32 transAcctSeq);
|
void incAcctSeq(uint32 transAcctSeq);
|
||||||
void syncLedger(const uint160& acctID);
|
void syncLedger(const uint160& acctID);
|
||||||
|
|
||||||
|
|||||||
15
Wallet.cpp
15
Wallet.cpp
@@ -418,6 +418,13 @@ uint64 LocalAccount::getBalance() const
|
|||||||
return la->getEffectiveBalance();
|
return la->getEffectiveBalance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocalAccount::syncLedger(uint64_t lb, uint32_t ls)
|
||||||
|
{
|
||||||
|
LocalAccountEntry::pointer la(mFamily->get(mSeq));
|
||||||
|
if(!la) return ;
|
||||||
|
la->syncLedger(lb, ls);
|
||||||
|
}
|
||||||
|
|
||||||
void LocalAccount::setLedgerBalance(uint64_t lb)
|
void LocalAccount::setLedgerBalance(uint64_t lb)
|
||||||
{
|
{
|
||||||
LocalAccountEntry::pointer la(mFamily->get(mSeq));
|
LocalAccountEntry::pointer la(mFamily->get(mSeq));
|
||||||
@@ -650,6 +657,14 @@ LocalAccountFamily::pointer Wallet::doPublic(const std::string& pubKey, bool do_
|
|||||||
{
|
{
|
||||||
// Generate root key
|
// Generate root key
|
||||||
EC_KEY *pkey=CKey::GenerateRootPubKey(pubKey);
|
EC_KEY *pkey=CKey::GenerateRootPubKey(pubKey);
|
||||||
|
if(!pkey)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
std::cerr << "Unable to generate root public key" << std::endl;
|
||||||
|
assert(false);
|
||||||
|
#endif
|
||||||
|
return LocalAccountFamily::pointer();
|
||||||
|
}
|
||||||
|
|
||||||
// Extract family name
|
// Extract family name
|
||||||
std::vector<unsigned char> rootPubKey(33, 0);
|
std::vector<unsigned char> rootPubKey(33, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user