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