mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Bugfixes.
This commit is contained in:
14
src/Ledger.h
14
src/Ledger.h
@@ -18,17 +18,17 @@
|
||||
|
||||
enum LedgerStateParms
|
||||
{
|
||||
lepNONE = 0, // no special flags
|
||||
lepNONE = 0, // no special flags
|
||||
|
||||
// input flags
|
||||
lepCREATE, // Create if not present
|
||||
lepCREATE = 1, // Create if not present
|
||||
|
||||
// output flags
|
||||
lepOKAY, // success
|
||||
lepMISSING, // No node in that slot
|
||||
lepWRONGTYPE, // Node of different type there
|
||||
lepCREATED, // Node was created
|
||||
lepERROR, // error
|
||||
lepOKAY = 2, // success
|
||||
lepMISSING = 4, // No node in that slot
|
||||
lepWRONGTYPE = 8, // Node of different type there
|
||||
lepCREATED = 16, // Node was created
|
||||
lepERROR = 32, // error
|
||||
};
|
||||
|
||||
class Ledger : public boost::enable_shared_from_this<Ledger>
|
||||
|
||||
@@ -191,12 +191,13 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
|
||||
// WRITEME: Special case code for changing transaction key
|
||||
for (std::vector<AffectedAccount>::iterator it=accounts.begin(), end=accounts.end();
|
||||
it != end; ++it)
|
||||
{ if (it->first == taaCREATE)
|
||||
{
|
||||
if (it->first == taaCREATE)
|
||||
{
|
||||
if (mLedger->writeBack(lepCREATE, it->second) & lepERROR)
|
||||
assert(false);
|
||||
}
|
||||
else if (it->first==taaMODIFY)
|
||||
else if (it->first == taaMODIFY)
|
||||
{
|
||||
if (mLedger->writeBack(lepNONE, it->second) & lepERROR)
|
||||
assert(false);
|
||||
@@ -235,7 +236,7 @@ TransactionEngineResult TransactionEngine::doClaim(const SerializedTransaction&
|
||||
}
|
||||
|
||||
LedgerStateParms qry = lepNONE;
|
||||
SerializedLedgerEntry::pointer dest = mLedger->getAccountRoot(qry, sourceAccountID);
|
||||
SerializedLedgerEntry::pointer dest = accounts[0].second;
|
||||
|
||||
if (!dest)
|
||||
{
|
||||
@@ -265,8 +266,6 @@ TransactionEngineResult TransactionEngine::doClaim(const SerializedTransaction&
|
||||
// Set the public key needed to use the account.
|
||||
dest->setIFieldH160(sfAuthorizedKey, hGeneratorID);
|
||||
|
||||
accounts.push_back(std::make_pair(taaMODIFY, dest));
|
||||
|
||||
// Construct a generator map entry.
|
||||
gen = boost::make_shared<SerializedLedgerEntry>(ltGENERATOR_MAP);
|
||||
|
||||
@@ -289,6 +288,8 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
|
||||
// Does the destination account exist?
|
||||
if (!destAccount) return tenINVALID;
|
||||
LedgerStateParms qry = lepNONE;
|
||||
|
||||
// FIXME: If this transfer is to the same account, bad things will happen
|
||||
SerializedLedgerEntry::pointer dest = mLedger->getAccountRoot(qry, destAccount);
|
||||
if (!dest)
|
||||
{ // can this transaction create an account
|
||||
|
||||
Reference in New Issue
Block a user