File tree 10 files changed +11
-79
lines changed
10 files changed +11
-79
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ add_executable(fuzz
76
76
p2p_transport_serialization.cpp
77
77
package_eval.cpp
78
78
parse_hd_keypath.cpp
79
+ parse_iso8601.cpp
79
80
parse_numbers.cpp
80
81
parse_script.cpp
81
82
parse_univalue.cpp
Original file line number Diff line number Diff line change 1
- // Copyright (c) 2019-2022 The Bitcoin Core developers
1
+ // Copyright (c) 2019-present The Bitcoin Core developers
2
2
// Distributed under the MIT software license, see the accompanying
3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
5
5
#include < test/fuzz/FuzzedDataProvider.h>
6
6
#include < test/fuzz/fuzz.h>
7
7
#include < util/time.h>
8
- #include < wallet/rpc/util.h>
9
8
10
9
#include < cassert>
11
10
#include < cstdint>
@@ -21,14 +20,8 @@ FUZZ_TARGET(parse_iso8601)
21
20
22
21
const std::string iso8601_datetime = FormatISO8601DateTime (random_time);
23
22
(void )FormatISO8601Date (random_time);
24
- const int64_t parsed_time_1 = wallet::ParseISO8601DateTime (iso8601_datetime);
25
- if (random_time >= 0 ) {
26
- assert (parsed_time_1 >= 0 );
27
- if (iso8601_datetime.length () == 20 ) {
28
- assert (parsed_time_1 == random_time);
29
- }
30
- }
23
+ const int64_t parsed_time_1{ParseISO8601DateTime (iso8601_datetime).value ()};
24
+ assert (parsed_time_1 == random_time);
31
25
32
- const int64_t parsed_time_2 = wallet::ParseISO8601DateTime (random_string);
33
- assert (parsed_time_2 >= 0 );
26
+ (void )ParseISO8601DateTime (random_string);
34
27
}
Original file line number Diff line number Diff line change 1
- // Copyright (c) 2009-2022 The Bitcoin Core developers
1
+ // Copyright (c) 2009-present The Bitcoin Core developers
2
2
// Distributed under the MIT software license, see the accompanying
3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
@@ -549,7 +549,7 @@ RPCHelpMan importwallet()
549
549
continue ;
550
550
CKey key = DecodeSecret (vstr[0 ]);
551
551
if (key.IsValid ()) {
552
- int64_t nTime = ParseISO8601DateTime (vstr[1 ]);
552
+ int64_t nTime{ ParseISO8601DateTime (vstr[1 ]). value_or ( 0 )} ;
553
553
std::string strLabel;
554
554
bool fLabel = true ;
555
555
for (unsigned int nStr = 2 ; nStr < vstr.size (); nStr++) {
@@ -569,7 +569,7 @@ RPCHelpMan importwallet()
569
569
} else if (IsHex (vstr[0 ])) {
570
570
std::vector<unsigned char > vData (ParseHex (vstr[0 ]));
571
571
CScript script = CScript (vData.begin (), vData.end ());
572
- int64_t birth_time = ParseISO8601DateTime (vstr[1 ]);
572
+ int64_t birth_time{ ParseISO8601DateTime (vstr[1 ]). value_or ( 0 )} ;
573
573
if (birth_time > 0 ) nTimeBegin = std::min (nTimeBegin, birth_time);
574
574
scripts.emplace_back (script, birth_time);
575
575
}
Original file line number Diff line number Diff line change 1
- // Copyright (c) 2011-2022 The Bitcoin Core developers
1
+ // Copyright (c) 2011-present The Bitcoin Core developers
2
2
// Distributed under the MIT software license, see the accompanying
3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
14
14
#include < string_view>
15
15
#include < univalue.h>
16
16
17
- #include < boost/date_time/posix_time/posix_time.hpp>
18
-
19
17
namespace wallet {
20
18
static const std::string WALLET_ENDPOINT_BASE = " /wallet/" ;
21
19
const std::string HELP_REQUIRING_PASSPHRASE{" \n Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.\n " };
22
20
23
- int64_t ParseISO8601DateTime (const std::string& str)
24
- {
25
- static const boost::posix_time::ptime epoch = boost::posix_time::from_time_t (0 );
26
- static const std::locale loc (std::locale::classic (),
27
- new boost::posix_time::time_input_facet (" %Y-%m-%dT%H:%M:%SZ" ));
28
- std::istringstream iss (str);
29
- iss.imbue (loc);
30
- boost::posix_time::ptime ptime (boost::date_time::not_a_date_time);
31
- iss >> ptime;
32
- if (ptime.is_not_a_date_time () || epoch > ptime)
33
- return 0 ;
34
- return (ptime - epoch).total_seconds ();
35
- }
36
-
37
21
bool GetAvoidReuseFlag (const CWallet& wallet, const UniValue& param) {
38
22
bool can_avoid_reuse = wallet.IsWalletFlagSet (WALLET_FLAG_AVOID_REUSE);
39
23
bool avoid_reuse = param.isNull () ? can_avoid_reuse : param.get_bool ();
Original file line number Diff line number Diff line change 1
- // Copyright (c) 2017-2022 The Bitcoin Core developers
1
+ // Copyright (c) 2017-present The Bitcoin Core developers
2
2
// Distributed under the MIT software license, see the accompanying
3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
@@ -51,7 +51,6 @@ std::string LabelFromValue(const UniValue& value);
51
51
void PushParentDescriptors (const CWallet& wallet, const CScript& script_pubkey, UniValue& entry);
52
52
53
53
void HandleWalletError (const std::shared_ptr<CWallet> wallet, DatabaseStatus& status, bilingual_str& error);
54
- int64_t ParseISO8601DateTime (const std::string& str);
55
54
void AppendLastProcessedBlock (UniValue& entry, const CWallet& wallet) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
56
55
} // namespace wallet
57
56
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ target_sources(test_bitcoin
14
14
init_tests.cpp
15
15
ismine_tests.cpp
16
16
psbt_wallet_tests.cpp
17
- rpc_util_tests.cpp
18
17
scriptpubkeyman_tests.cpp
19
18
spend_tests.cpp
20
19
wallet_crypto_tests.cpp
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ target_sources(fuzz
9
9
crypter.cpp
10
10
fees.cpp
11
11
$<$<BOOL :${USE_SQLITE} >:${CMAKE_CURRENT_LIST_DIR} /notifications.cpp>
12
- parse_iso8601.cpp
13
12
$<$<BOOL :${USE_SQLITE} >:${CMAKE_CURRENT_LIST_DIR} /scriptpubkeyman.cpp>
14
13
spend.cpp
15
14
wallet_bdb_parser.cpp
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 20
20
EXCLUDED_DIRS = ["contrib/devtools/bitcoin-tidy/" ,
21
21
] + SHARED_EXCLUDED_SUBTREES
22
22
23
- EXPECTED_BOOST_INCLUDES = ["boost/date_time/posix_time/posix_time.hpp" ,
23
+ EXPECTED_BOOST_INCLUDES = [
24
24
"boost/multi_index/detail/hash_index_iterator.hpp" ,
25
25
"boost/multi_index/hashed_index.hpp" ,
26
26
"boost/multi_index/identity.hpp" ,
Original file line number Diff line number Diff line change 3
3
"$schema" : " https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json" ,
4
4
"builtin-baseline" : " c82f74667287d3dc386bce81e44964370c91a289" ,
5
5
"dependencies" : [
6
- " boost-date-time" ,
7
6
" boost-multi-index" ,
8
7
" boost-signals2" ,
9
8
" libevent"
You can’t perform that action at this time.
0 commit comments