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

This commit is contained in:
Arthur Britto
2012-05-15 18:21:51 -07:00
6 changed files with 38 additions and 42 deletions

View File

@@ -48,7 +48,7 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>BOOST_TEST_NO_MAIN;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>BOOST_TEST_ALTERNATIVE_INIT_API;BOOST_TEST_NO_MAIN;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\OpenSSL\include;..\boost_1_47_0;..\protobuf-2.4.1\src\</AdditionalIncludeDirectories>
</ClCompile>
<Link>

View File

@@ -557,7 +557,7 @@ Json::Value RPCServer::doLedger(Json::Value& params)
int paramCount = getParamCount(params);
if (paramCount == 0);
if (paramCount == 0)
{
Json::Value ret(Json::objectValue), current(Json::objectValue), closed(Json::objectValue);
theApp->getMasterLedger().getCurrentLedger()->addJson(current);

View File

@@ -436,10 +436,7 @@ bool SHAMap::addGiveItem(SHAMapItem::pointer item, bool isTransaction)
stack.pop();
if (node->isLeaf() && (node->peekItem()->getTag() == tag))
{
std::cerr << "addGiveItem ends on leaf with same tag" << std::endl;
return false;
}
throw std::runtime_error("addGiveItem ends on leaf with same tag");
uint256 prevHash;
returnNode(node, true);
@@ -479,7 +476,8 @@ bool SHAMap::addGiveItem(SHAMapItem::pointer item, bool isTransaction)
#ifdef ST_DEBUG
std::cerr << "need new inner node at " << node->getDepth() << std::endl;
#endif
SHAMapTreeNode::pointer newNode=boost::make_shared<SHAMapTreeNode>(node->getChildNodeID(b1), mSeq);
SHAMapTreeNode::pointer newNode =
boost::make_shared<SHAMapTreeNode>(node->getChildNodeID(b1), mSeq);
newNode->makeInner();
if(!mTNByID.insert(std::make_pair(SHAMapNode(*newNode), newNode)).second)
assert(false);
@@ -503,9 +501,7 @@ bool SHAMap::addGiveItem(SHAMapItem::pointer item, bool isTransaction)
node->setChildHash(b2, newNode->getNodeHash());
}
prevHash=node->getNodeHash();
assert(prevHash.isNonZero());
dirtyUp(stack, tag, prevHash);
dirtyUp(stack, tag, node->getNodeHash());
return true;
}
@@ -534,7 +530,7 @@ bool SHAMap::updateGiveItem(SHAMapItem::pointer item, bool isTransaction)
returnNode(node, true);
if (!node->setItem(item, isTransaction ? SHAMapTreeNode::tnTRANSACTION : SHAMapTreeNode::tnACCOUNT_STATE))
return true;
return false;
dirtyUp(stack, tag, node->getNodeHash());
return true;

View File

@@ -278,7 +278,7 @@ bool SHAMapTreeNode::updateHash()
{
Serializer s;
mItem->addRaw(s);
s.add160(mItem->getTag().to160());
s.add256(mItem->getTag());
nh = s.getSHA512Half();
}
else if (mType == tnTRANSACTION)
@@ -299,7 +299,7 @@ bool SHAMapTreeNode::setItem(SHAMapItem::pointer& i, TNType type)
mItem = i;
assert(isLeaf());
updateHash();
return getNodeHash() == hash;
return getNodeHash() != hash;
}
SHAMapItem::pointer SHAMapTreeNode::getItem() const

View File

@@ -70,10 +70,10 @@ int main(int argc, char* argv[])
("help,h", "Display this message.")
("rpc", "Perform rpc command (default).")
("test,t", "Perform unit tests.")
("parameters", po::value< vector<string> >(), "Specify comma seperated parameters.")
("parameters", po::value< vector<string> >(), "Specify comma separated parameters.")
;
// Interpert positional arguments as --parameters.
// Interpret positional arguments as --parameters.
po::positional_options_description p;
p.add("parameters", -1);
@@ -124,7 +124,7 @@ int main(int argc, char* argv[])
pvCmd.push_back(const_cast<char*>(param.c_str()));
}
// iResult = unit_test_main(init_unit_test, iCmd, &pvCmd[0]);
iResult = unit_test_main(init_unit_test, iCmd, &pvCmd[0]);
}
else if (!vm.count("parameters"))
{