aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-07-08 09:01:49 +0200
committerMacroFake <falke.marco@gmail.com>2022-07-08 09:02:05 +0200
commita33ec8a6935102f0fad2c8132277234b0b63d852 (patch)
tree11e127a80c70fda0696a4e978ea88b9f84702b3c /src
parentc3936cc53dabc5de531249b8097e1c25f41a4c3b (diff)
parent4ebf6e35dcac936342525ec7b4b77a82c71693e7 (diff)
downloadbitcoin-a33ec8a6935102f0fad2c8132277234b0b63d852.tar.xz
Merge bitcoin/bitcoin#25316: 23.x backports
4ebf6e35dcac936342525ec7b4b77a82c71693e7 p2p: always set nTime for self-advertisements (Martin Zumsande) 039ef215bc1268cefb645472d411993e5582486b tests: Use descriptor that requires both legacy and segwit (Andrew Chow) 5fd25eb9cb52d09a4bf8b37b9d442e25bb22074e tests: Calculate input weight more accurately (Andrew Chow) bd6d3ac8b7edf257f76ceb819f5d657313161585 windeploy: Renewed windows code signing certificate (Andrew Chow) 32fa522a80c87231dc6194b982f64440c801b7d4 test: ensure createmultisig and addmultisigaddress are not returning any warning for expected cases (brunoerg) 7658055c4e97b998639b67fd6dca386c1cdc748a rpc: fix inappropriate warning for address type p2sh-segwit in createmultisig and addmultisigaddress (brunoerg) Pull request description: Backports: - https://github.com/bitcoin/bitcoin/pull/24454 - https://github.com/bitcoin/bitcoin/pull/25201 - https://github.com/bitcoin/bitcoin/pull/25220 - https://github.com/bitcoin/bitcoin/pull/25314 ACKs for top commit: LarryRuane: re-utACK 4ebf6e35dcac936342525ec7b4b77a82c71693e7 achow101: ACK 4ebf6e35dcac936342525ec7b4b77a82c71693e7 Tree-SHA512: add3999d0330b3442f3894fce38ad9b5adc75da7d681c949e1d052bac5520c2c6fb06eba98bfbeb4aa9a560170451d24bf00d08dddd4a3d080030ecb8ad61882
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp2
-rw-r--r--src/rpc/misc.cpp4
-rw-r--r--src/test/net_tests.cpp7
-rw-r--r--src/wallet/rpc/addresses.cpp4
4 files changed, 10 insertions, 7 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 955eec46e3..1b0e7369a3 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -249,7 +249,7 @@ std::optional<CAddress> GetLocalAddrForPeer(CNode *pnode)
if (pnode->IsInboundConn()) {
// For inbound connections, assume both the address and the port
// as seen from the peer.
- addrLocal = CAddress{pnode->GetAddrLocal(), addrLocal.nServices};
+ addrLocal = CAddress{pnode->GetAddrLocal(), addrLocal.nServices, addrLocal.nTime};
} else {
// For outbound connections, assume just the address as seen from
// the peer and leave the port in `addrLocal` as returned by
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index 8d7b48d697..2dace52777 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -169,11 +169,11 @@ static RPCHelpMan createmultisig()
result.pushKV("descriptor", descriptor->ToString());
UniValue warnings(UniValue::VARR);
- if (!request.params[2].isNull() && OutputTypeFromDestination(dest) != output_type) {
+ if (descriptor->GetOutputType() != output_type) {
// Only warns if the user has explicitly chosen an address type we cannot generate
warnings.push_back("Unable to make chosen address type, please ensure no uncompressed public keys are present.");
}
- if (warnings.size()) result.pushKV("warnings", warnings);
+ if (!warnings.empty()) result.pushKV("warnings", warnings);
return result;
},
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp
index fcb1a80765..74e97ff67a 100644
--- a/src/test/net_tests.cpp
+++ b/src/test/net_tests.cpp
@@ -675,10 +675,13 @@ BOOST_AUTO_TEST_CASE(get_local_addr_for_peer_port)
const uint16_t bind_port = 20001;
m_node.args->ForceSetArg("-bind", strprintf("3.4.5.6:%u", bind_port));
+ const uint32_t current_time = static_cast<uint32_t>(GetAdjustedTime());
+ SetMockTime(current_time);
+
// Our address:port as seen from the peer, completely different from the above.
in_addr peer_us_addr;
peer_us_addr.s_addr = htonl(0x02030405);
- const CAddress peer_us{CService{peer_us_addr, 20002}, NODE_NETWORK};
+ const CAddress peer_us{CService{peer_us_addr, 20002}, NODE_NETWORK, current_time};
// Create a peer with a routable IPv4 address (outbound).
in_addr peer_out_in_addr;
@@ -699,7 +702,7 @@ BOOST_AUTO_TEST_CASE(get_local_addr_for_peer_port)
// Without the fix peer_us:8333 is chosen instead of the proper peer_us:bind_port.
auto chosen_local_addr = GetLocalAddrForPeer(&peer_out);
BOOST_REQUIRE(chosen_local_addr);
- const CService expected{peer_us_addr, bind_port};
+ const CAddress expected{CService{peer_us_addr, bind_port}, NODE_NETWORK, current_time};
BOOST_CHECK(*chosen_local_addr == expected);
// Create a peer with a routable IPv4 address (inbound).
diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp
index 51587a64a3..bb9d2aea9b 100644
--- a/src/wallet/rpc/addresses.cpp
+++ b/src/wallet/rpc/addresses.cpp
@@ -302,11 +302,11 @@ RPCHelpMan addmultisigaddress()
result.pushKV("descriptor", descriptor->ToString());
UniValue warnings(UniValue::VARR);
- if (!request.params[3].isNull() && OutputTypeFromDestination(dest) != output_type) {
+ if (descriptor->GetOutputType() != output_type) {
// Only warns if the user has explicitly chosen an address type we cannot generate
warnings.push_back("Unable to make chosen address type, please ensure no uncompressed public keys are present.");
}
- if (warnings.size()) result.pushKV("warnings", warnings);
+ if (!warnings.empty()) result.pushKV("warnings", warnings);
return result;
},