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 #1937 from KomodoPlatform/merge_utxos
UTXO merging
- Loading branch information
Showing
9 changed files
with
165 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/****************************************************************************** | ||
* Copyright © 2013-2022 The Komodo Platform Developers. * | ||
* * | ||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * | ||
* the top-level directory of this distribution for the individual copyright * | ||
* holder information and the developer policies on copyright and licensing. * | ||
* * | ||
* Unless otherwise agreed in a custom licensing agreement, no part of the * | ||
* Komodo Platform software, including this file may be copied, modified, * | ||
* propagated or distributed except according to the terms contained in the * | ||
* LICENSE file * | ||
* * | ||
* Removal or modification of this copyright notice is prohibited. * | ||
* * | ||
******************************************************************************/ | ||
|
||
//! Dependencies Headers | ||
#include <nlohmann/json.hpp> | ||
|
||
//! Project Headers | ||
#include "utxo.merge.params.hpp" | ||
|
||
namespace mm2::api | ||
{ | ||
void | ||
to_json(nlohmann::json& j, const utxo_merge_params& cfg) | ||
{ | ||
j["merge_at"] = cfg.merge_at; | ||
j["check_every"] = cfg.check_every; | ||
j["max_merge_at_once"] = cfg.max_merge_at_once; | ||
} | ||
} // namespace mm2::api |
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,36 @@ | ||
/****************************************************************************** | ||
* Copyright © 2013-2022 The Komodo Platform Developers. * | ||
* * | ||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * | ||
* the top-level directory of this distribution for the individual copyright * | ||
* holder information and the developer policies on copyright and licensing. * | ||
* * | ||
* Unless otherwise agreed in a custom licensing agreement, no part of the * | ||
* Komodo Platform software, including this file may be copied, modified, * | ||
* propagated or distributed except according to the terms contained in the * | ||
* LICENSE file * | ||
* * | ||
* Removal or modification of this copyright notice is prohibited. * | ||
* * | ||
******************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <nlohmann/json_fwd.hpp> | ||
|
||
namespace mm2::api | ||
{ | ||
struct utxo_merge_params | ||
{ | ||
std::size_t merge_at; | ||
std::size_t check_every; | ||
std::size_t max_merge_at_once; | ||
}; | ||
|
||
void to_json(nlohmann::json& j, const utxo_merge_params& cfg); | ||
} | ||
|
||
namespace atomic_dex | ||
{ | ||
using t_utxo_merge_params = ::mm2::api::utxo_merge_params; | ||
} // namespace atomic_dex |
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,36 @@ | ||
/****************************************************************************** | ||
* Copyright © 2013-2022 The Komodo Platform Developers. * | ||
* * | ||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * | ||
* the top-level directory of this distribution for the individual copyright * | ||
* holder information and the developer policies on copyright and licensing. * | ||
* * | ||
* Unless otherwise agreed in a custom licensing agreement, no part of the * | ||
* Komodo Platform software, including this file may be copied, modified, * | ||
* propagated or distributed except according to the terms contained in the * | ||
* LICENSE file * | ||
* * | ||
* Removal or modification of this copyright notice is prohibited. * | ||
* * | ||
******************************************************************************/ | ||
|
||
//! Deps | ||
#include "doctest/doctest.h" | ||
#include <nlohmann/json.hpp> | ||
|
||
#include "atomicdex/api/mm2/utxo.merge.params.hpp" | ||
|
||
TEST_CASE("mm2::api::utxo_merge_params serialisation") | ||
{ | ||
const nlohmann::json expected_json = R"( | ||
{ | ||
"merge_at":50, | ||
"check_every":10, | ||
"max_merge_at_once":25 | ||
} | ||
)"_json; | ||
mm2::api::utxo_merge_params request{.merge_at = 50, .check_every = 10, .max_merge_at_once = 25}; | ||
nlohmann::json j; | ||
mm2::api::to_json(j, request); | ||
CHECK_EQ(j, expected_json); | ||
} |