Merge branch 'master' of github.com:jedmccaleb/NewCoin

Conflicts:
	src/main.cpp
This commit is contained in:
jed
2012-05-15 16:58:21 -07:00
6 changed files with 28 additions and 25 deletions

View File

@@ -12,7 +12,7 @@ LedgerEntryFormat LedgerFormats[]=
{ S_FIELD(Balance), STI_UINT64, SOE_REQUIRED, 0 },
{ S_FIELD(LastReceive), STI_UINT32, SOE_REQUIRED, 0 },
{ S_FIELD(LastTxn), STI_UINT32, SOE_REQUIRED, 0 },
{ S_FIELD(AuthorizedKey),STI_VL, SOE_IFFLAG, 1 },
{ S_FIELD(AuthorizedKey),STI_HASH160, SOE_IFFLAG, 1 },
{ S_FIELD(EmailHash), STI_HASH128, SOE_IFFLAG, 2 },
{ S_FIELD(WalletLocator),STI_HASH256, SOE_IFFLAG, 4 },
{ S_FIELD(MessageKey), STI_VL, SOE_IFFLAG, 8 },
@@ -21,7 +21,7 @@ LedgerEntryFormat LedgerFormats[]=
},
{ "GeneratorMap", ltGENERATOR_MAP, {
{ S_FIELD(Flags), STI_UINT32, SOE_FLAGS, 0 },
{ S_FIELD(GeneratorID), STI_ACCOUNT, SOE_REQUIRED, 0 },
{ S_FIELD(GeneratorID), STI_HASH160, SOE_REQUIRED, 0 },
{ S_FIELD(Generator), STI_VL, SOE_REQUIRED, 0 },
{ S_FIELD(Extensions), STI_TL, SOE_IFFLAG, 0x01000000 },
{ sfInvalid, NULL, STI_DONE, SOE_NEVER, -1 } }
@@ -55,11 +55,11 @@ LedgerEntryFormat LedgerFormats[]=
LedgerEntryFormat* getLgrFormat(LedgerEntryType t)
{
LedgerEntryFormat* f=LedgerFormats;
while(f->t_name!=NULL)
LedgerEntryFormat* f = LedgerFormats;
while(f->t_name != NULL)
{
if(f->t_type==t) return f;
f++;
if(f->t_type == t) return f;
++f;
}
return NULL;
}

View File

@@ -33,7 +33,7 @@ LedgerStateParms Ledger::writeBack(LedgerStateParms parms, SerializedLedgerEntry
return lepCREATED;
}
if(!mAccountStateMap->updateGiveItem(item, false))
if (!mAccountStateMap->updateGiveItem(item, false))
{
assert(false);
return lepERROR;

View File

@@ -521,12 +521,12 @@ bool SHAMap::updateGiveItem(SHAMapItem::pointer item, bool isTransaction)
boost::recursive_mutex::scoped_lock sl(mLock);
std::stack<SHAMapTreeNode::pointer> stack = getStack(tag, true);
if(stack.empty()) throw SHAMapException(MissingNode);
if (stack.empty()) throw SHAMapException(MissingNode);
SHAMapTreeNode::pointer node=stack.top();
stack.pop();
if (!node->isLeaf() || (node->peekItem()->getTag() == tag) )
if (!node->isLeaf() || (node->peekItem()->getTag() != tag) )
{
assert(false);
return false;

View File

@@ -189,7 +189,7 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
if (result == terSUCCESS)
{ // Write back the account states and add the transaction to the ledger
// 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)
{ if (it->first == taaCREATE)
{
@@ -198,12 +198,12 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
}
else if (it->first==taaMODIFY)
{
if(mLedger->writeBack(lepNONE, it->second) & lepERROR)
if (mLedger->writeBack(lepNONE, it->second) & lepERROR)
assert(false);
}
else if (it->first == taaDELETE)
{
if(!mLedger->peekAccountStateMap()->delItem(it->second->getIndex()))
if (!mLedger->peekAccountStateMap()->delItem(it->second->getIndex()))
assert(false);
}
}

View File

@@ -55,11 +55,11 @@ TransactionFormat InnerTxnFormats[]=
TransactionFormat* getTxnFormat(TransactionType t)
{
TransactionFormat* f=InnerTxnFormats;
while(f->t_name!=NULL)
TransactionFormat* f = InnerTxnFormats;
while(f->t_name != NULL)
{
if(f->t_type==t) return f;
f++;
if(f->t_type == t) return f;
++f;
}
return NULL;
}

View File

@@ -6,6 +6,7 @@
#include <iostream>
#include <boost/foreach.hpp>
#include <boost/program_options.hpp>
#include <boost/test/included/unit_test.hpp>
@@ -108,20 +109,22 @@ int main(int argc, char* argv[])
}
else if (vm.count("test"))
{
std::vector<std::string> vCmd;
int iCmd = vm.count("parameters");
int iCmd = vm.count("parameters");
std::vector<char*> pvCmd;
pvCmd.push_back(argv[0]);
if (iCmd)
{
std::vector<std::string> vCmd;
vCmd = vm["parameters"].as<std::vector<std::string> >();
std::vector<char*> pvCmd;
BOOST_FOREACH(std::string& param, vCmd)
pvCmd.push_back(const_cast<char*>(param.c_str()));
}
pvCmd.resize(iCmd);
for (int i=0; i != iCmd; ++i)
pvCmd[i] = (char*) (vCmd[0].c_str());
//iResult = unit_test_main(init_unit_test, iCmd, &pvCmd.front());
iResult = unit_test_main(init_unit_test, iCmd, &pvCmd[0]);
}
else if (!vm.count("parameters"))
{