Cleanups.

This commit is contained in:
JoelKatz
2012-02-05 07:18:35 -08:00
parent 3ec994f435
commit 4c1c53df87

View File

@@ -1,6 +1,7 @@
#include <cassert> #include <cassert>
#include "boost/lexical_cast.hpp" #include "boost/lexical_cast.hpp"
#include "boost/make_shared.hpp"
#include "Application.h" #include "Application.h"
#include "Transaction.h" #include "Transaction.h"
@@ -62,7 +63,7 @@ Transaction::Transaction(const std::vector<unsigned char> &t, bool validate) : m
std::vector<unsigned char> pubKey; std::vector<unsigned char> pubKey;
if(!s.getRaw(pubKey, BTxPSPubK, BTxLSPubK)) { assert(false); return; } if(!s.getRaw(pubKey, BTxPSPubK, BTxLSPubK)) { assert(false); return; }
mFromPubKey=CKey::pointer(new CKey()); mFromPubKey=boost::make_shared<CKey>();
if(!mFromPubKey->SetPubKey(pubKey)) return; if(!mFromPubKey->SetPubKey(pubKey)) return;
mAccountFrom=Hash160(pubKey); mAccountFrom=Hash160(pubKey);
mFromPubKey=theApp->getPubKeyCache().store(mAccountFrom, mFromPubKey); mFromPubKey=theApp->getPubKeyCache().store(mAccountFrom, mFromPubKey);
@@ -128,7 +129,7 @@ bool Transaction::checkSign() const
Serializer::pointer Transaction::getRaw(bool prefix) const Serializer::pointer Transaction::getRaw(bool prefix) const
{ {
Serializer::pointer ret(new Serializer(77)); Serializer::pointer ret=boost::make_shared<Serializer>(77);
if(prefix) ret->add32(0x54584e00u); if(prefix) ret->add32(0x54584e00u);
ret->add160(mAccountTo); ret->add160(mAccountTo);
ret->add64(mAmount); ret->add64(mAmount);
@@ -293,7 +294,7 @@ bool Transaction::convertToTransactions(uint32 firstLedgerSeq, uint32 secondLedg
Transaction::pointer firstTrans, secondTrans; Transaction::pointer firstTrans, secondTrans;
if(!!first) if(!!first)
{ // transaction in our table { // transaction in our table
firstTrans=Transaction::pointer(new Transaction(first->getData(), checkFirstTransactions)); firstTrans=boost::make_shared<Transaction>(first->getData(), checkFirstTransactions);
if( (firstTrans->getStatus()==INVALID) || (firstTrans->getID()!=id) ) if( (firstTrans->getStatus()==INVALID) || (firstTrans->getID()!=id) )
{ {
firstTrans->setStatus(INVALID, firstLedgerSeq); firstTrans->setStatus(INVALID, firstLedgerSeq);
@@ -304,7 +305,7 @@ bool Transaction::convertToTransactions(uint32 firstLedgerSeq, uint32 secondLedg
if(!!second) if(!!second)
{ // transaction in other table { // transaction in other table
secondTrans=Transaction::pointer(new Transaction(second->getData(), checkSecondTransactions)); secondTrans=boost::make_shared<Transaction>(second->getData(), checkSecondTransactions);
if( (secondTrans->getStatus()==INVALID) || (secondTrans->getID()!=id) ) if( (secondTrans->getStatus()==INVALID) || (secondTrans->getID()!=id) )
{ {
secondTrans->setStatus(INVALID, secondLedgerSeq); secondTrans->setStatus(INVALID, secondLedgerSeq);