diff options
| author | Jeff Garzik <[email protected]> | 2012-04-14 08:50:43 -0700 |
|---|---|---|
| committer | Jeff Garzik <[email protected]> | 2012-04-14 08:50:43 -0700 |
| commit | 22014c31e5955f29ccf84cbdce3d84a025a6f771 (patch) | |
| tree | 0254452a8a2d47ac06bb0b57258cc4bc51c3727e /src/main.cpp | |
| parent | Merge pull request #1089 from laanwj/2012_04_translationupdate (diff) | |
| parent | Database micro-optimization for "tx" network message (diff) | |
| download | discoin-22014c31e5955f29ccf84cbdce3d84a025a6f771.tar.xz discoin-22014c31e5955f29ccf84cbdce3d84a025a6f771.zip | |
Merge pull request #1093 from jgarzik/tx-opt
Database micro-optimization for "tx" network message
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp index bdafae8eb..a6393a5c8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -592,12 +592,6 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi return true; } -bool CTransaction::AcceptToMemoryPool(bool fCheckInputs, bool* pfMissingInputs) -{ - CTxDB txdb("r"); - return AcceptToMemoryPool(txdb, fCheckInputs, pfMissingInputs); -} - uint64 nPooledTx = 0; bool CTransaction::AddToMemoryPoolUnchecked() @@ -2522,6 +2516,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) { vector<uint256> vWorkQueue; CDataStream vMsg(vRecv); + CTxDB txdb("r"); CTransaction tx; vRecv >> tx; @@ -2529,7 +2524,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) pfrom->AddInventoryKnown(inv); bool fMissingInputs = false; - if (tx.AcceptToMemoryPool(true, &fMissingInputs)) + if (tx.AcceptToMemoryPool(txdb, true, &fMissingInputs)) { SyncWithWallets(tx, NULL, true); RelayMessage(inv, vMsg); @@ -2549,7 +2544,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) CDataStream(vMsg) >> tx; CInv inv(MSG_TX, tx.GetHash()); - if (tx.AcceptToMemoryPool(true)) + if (tx.AcceptToMemoryPool(txdb, true)) { printf(" accepted orphan tx %s\n", inv.hash.ToString().substr(0,10).c_str()); SyncWithWallets(tx, NULL, true); |