forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Braydon Fuller
committed
May 16, 2016
1 parent
5e54311
commit c5b1b04
Showing
7 changed files
with
200 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Copyright (c) 2009-2010 Satoshi Nakamoto | ||
// Copyright (c) 2009-2015 The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef BITCOIN_SPENTINDEX_H | ||
#define BITCOIN_SPENTINDEX_H | ||
|
||
#include "uint256.h" | ||
#include "amount.h" | ||
|
||
struct CSpentIndexKey { | ||
uint256 txid; | ||
unsigned int outputIndex; | ||
|
||
ADD_SERIALIZE_METHODS; | ||
|
||
template <typename Stream, typename Operation> | ||
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { | ||
READWRITE(txid); | ||
READWRITE(outputIndex); | ||
} | ||
|
||
CSpentIndexKey(uint256 t, unsigned int i) { | ||
txid = t; | ||
outputIndex = i; | ||
} | ||
|
||
CSpentIndexKey() { | ||
SetNull(); | ||
} | ||
|
||
void SetNull() { | ||
txid.SetNull(); | ||
outputIndex = 0; | ||
} | ||
|
||
}; | ||
|
||
struct CSpentIndexValue { | ||
uint256 txid; | ||
unsigned int inputIndex; | ||
int blockHeight; | ||
CAmount satoshis; | ||
int addressType; | ||
uint160 addressHash; | ||
|
||
ADD_SERIALIZE_METHODS; | ||
|
||
template <typename Stream, typename Operation> | ||
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { | ||
READWRITE(txid); | ||
READWRITE(inputIndex); | ||
READWRITE(blockHeight); | ||
READWRITE(satoshis); | ||
READWRITE(addressType); | ||
READWRITE(addressHash); | ||
} | ||
|
||
CSpentIndexValue(uint256 t, unsigned int i, int h, CAmount s, int type, uint160 a) { | ||
txid = t; | ||
inputIndex = i; | ||
blockHeight = h; | ||
satoshis = s; | ||
addressType = type; | ||
addressHash = a; | ||
} | ||
|
||
CSpentIndexValue() { | ||
SetNull(); | ||
} | ||
|
||
void SetNull() { | ||
txid.SetNull(); | ||
inputIndex = 0; | ||
blockHeight = 0; | ||
satoshis = 0; | ||
addressType = 0; | ||
addressHash.SetNull(); | ||
} | ||
|
||
bool IsNull() const { | ||
return txid.IsNull(); | ||
} | ||
}; | ||
|
||
struct CSpentIndexKeyCompare | ||
{ | ||
bool operator()(const CSpentIndexKey& a, const CSpentIndexKey& b) const { | ||
if (a.txid == b.txid) { | ||
return a.outputIndex < b.outputIndex; | ||
} else { | ||
return a.txid < b.txid; | ||
} | ||
} | ||
}; | ||
|
||
#endif // BITCOIN_SPENTINDEX_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters