Any projects which want to use Hush code from now on will need to be licensed as GPLv3 or we will send the lawyers: https://www.softwarefreedom.org/ Notably, Komodo (KMD) is licensed as GPLv2 and is no longer compatible to receive code changes, without causing legal issues. MIT projects, such as Zcash, also cannot pull in changes from the Hush Full Node without permission from The Hush Developers, which may in some circumstances grant an MIT license on a case-by-case basis.
98 lines
2.1 KiB
C++
98 lines
2.1 KiB
C++
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
|
// Distributed under the GPLv3 software license, see the accompanying
|
|
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
|
|
|
#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) {
|
|
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) {
|
|
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
|