-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from konez2k/201908-patch
201908 patch
- Loading branch information
Showing
18 changed files
with
58,559 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,7 @@ src/qt/test/moc*.cpp | |
*.dmg | ||
|
||
*.json.h | ||
!invalid_outpoints.json.h | ||
*.raw.h | ||
|
||
#libtool object files | ||
|
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
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,63 @@ | ||
// Copyright (c) 2019 The BitGreen Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#include "invalid.h" | ||
#include "invalid_outpoints.json.h" | ||
|
||
#include "util.h" | ||
|
||
namespace invalid_out | ||
{ | ||
std::set<COutPoint> setInvalidOutPoints; | ||
|
||
UniValue read_json(const std::string& jsondata) | ||
{ | ||
UniValue v; | ||
|
||
if (!v.read(jsondata) || !v.isArray()) | ||
return UniValue(UniValue::VARR); | ||
|
||
return v.get_array(); | ||
} | ||
|
||
bool LoadOutpoints() | ||
{ | ||
UniValue v = read_json(LoadInvalidOutPoints()); | ||
|
||
if (v.empty()) { | ||
return false; | ||
} | ||
|
||
int count; | ||
for (unsigned int idx = 0; idx < v.size(); idx++) { | ||
const UniValue &val = v[idx]; | ||
const UniValue &o = val.get_obj(); | ||
|
||
const UniValue &vTxid = find_value(o, "txid"); | ||
if (!vTxid.isStr()) | ||
return false; | ||
|
||
uint256 txid = uint256(vTxid.get_str()); | ||
if (txid == 0) | ||
return false; | ||
|
||
const UniValue &vN = find_value(o, "n"); | ||
if (!vN.isNum()) | ||
return false; | ||
|
||
auto n = static_cast<uint32_t>(vN.get_int()); | ||
COutPoint out(txid, n); | ||
setInvalidOutPoints.insert(out); | ||
count++; | ||
} | ||
|
||
LogPrintf("%s(): loaded %d outpoints.\n", __func__, count); | ||
return true; | ||
} | ||
|
||
bool ContainsOutPoint(const COutPoint& out) | ||
{ | ||
return static_cast<bool>(setInvalidOutPoints.count(out)); | ||
} | ||
} |
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,22 @@ | ||
// Copyright (c) 2019 The BitGreen Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef BITGREEN_INVALID_H | ||
#define BITGREEN_INVALID_H | ||
|
||
#include <univalue/include/univalue.h> | ||
#include <primitives/transaction.h> | ||
|
||
namespace invalid_out | ||
{ | ||
extern std::set<COutPoint> setInvalidOutPoints; | ||
|
||
UniValue read_json(const std::string& jsondata); | ||
|
||
bool ContainsOutPoint(const COutPoint& out); | ||
bool LoadOutpoints(); | ||
bool LoadSerials(); | ||
} | ||
|
||
#endif //BITGREEN_INVALID_H |
Oops, something went wrong.