mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge pull request #4749 from PastaPastaPasta/develop-trivial-2022-04-03-pr2
trivial backports 2022 04 03 pr2
This commit is contained in:
commit
eb42d8eee4
@ -19,4 +19,4 @@ The following keys may be used to communicate sensitive information to developer
|
||||
| UdjinM6 | 3F5D 48C9 F002 93CD 365A 3A98 8359 2BD1 400D 58D9 |
|
||||
| Pasta | 2959 0362 EC87 8A81 FD3C 202B 5252 7BED ABE8 7984 |
|
||||
|
||||
You can import a key by running the following command with that individual’s fingerprint: `gpg --recv-keys "<fingerprint>"` Ensure that you put quotes around fingerprints containing spaces.
|
||||
You can import a key by running the following command with that individual’s fingerprint: `gpg --keyserver hkps://keys.openpgp.org --recv-keys "<fingerprint>"` Ensure that you put quotes around fingerprints containing spaces.
|
||||
|
12
configure.ac
12
configure.ac
@ -1206,14 +1206,6 @@ if test x$use_reduce_exports = xyes; then
|
||||
[AC_MSG_ERROR([Cannot set default symbol visibility. Use --disable-reduce-exports.])])
|
||||
fi
|
||||
|
||||
LEVELDB_CPPFLAGS=
|
||||
LIBLEVELDB=
|
||||
LIBMEMENV=
|
||||
AM_CONDITIONAL([EMBEDDED_LEVELDB],[true])
|
||||
AC_SUBST(LEVELDB_CPPFLAGS)
|
||||
AC_SUBST(LIBLEVELDB)
|
||||
AC_SUBST(LIBMEMENV)
|
||||
|
||||
dnl SUPPRESSED_CPPFLAGS=SUPPRESS_WARNINGS([$SOME_CPPFLAGS])
|
||||
dnl Replace -I with -isystem in $SOME_CPPFLAGS to suppress warnings from
|
||||
dnl headers from its include directories and return the result.
|
||||
@ -1638,8 +1630,8 @@ if test "x$use_ccache" != "xno"; then
|
||||
fi
|
||||
AC_MSG_RESULT($use_ccache)
|
||||
if test "x$use_ccache" = "xyes"; then
|
||||
AX_CHECK_COMPILE_FLAG([-fdebug-prefix-map=A=B],[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -fdebug-prefix-map=\$(abs_srcdir)=."],,[[$CXXFLAG_WERROR]])
|
||||
AX_CHECK_PREPROC_FLAG([-fmacro-prefix-map=A=B],[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -fmacro-prefix-map=\$(abs_srcdir)=."],,[[$CXXFLAG_WERROR]])
|
||||
AX_CHECK_COMPILE_FLAG([-fdebug-prefix-map=A=B],[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -fdebug-prefix-map=\$(abs_top_srcdir)=."],,[[$CXXFLAG_WERROR]])
|
||||
AX_CHECK_PREPROC_FLAG([-fmacro-prefix-map=A=B],[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -fmacro-prefix-map=\$(abs_top_srcdir)=."],,[[$CXXFLAG_WERROR]])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -81,7 +81,7 @@ def run():
|
||||
|
||||
print("Creating output .tar.gz file...")
|
||||
with out_sdktgz_path.open("wb") as fp:
|
||||
with gzip.GzipFile(fileobj=fp, compresslevel=9, mtime=0) as gzf:
|
||||
with gzip.GzipFile(fileobj=fp, mode='wb', compresslevel=9, mtime=0) as gzf:
|
||||
with tarfile.open(mode="w", fileobj=gzf) as tarfp:
|
||||
print("Adding MacOSX SDK {} files...".format(sdk_version))
|
||||
tarfp_add_with_base_change(tarfp, sdk_dir, out_name)
|
||||
|
@ -61,7 +61,6 @@ fi
|
||||
|
||||
if test "@host_os@" = darwin; then
|
||||
BREW=no
|
||||
PORT=no
|
||||
fi
|
||||
|
||||
PATH=$depends_prefix/native/bin:$PATH
|
||||
|
@ -11,6 +11,7 @@ Developer Notes
|
||||
- [Coding Style (Doxygen-compatible comments)](#coding-style-doxygen-compatible-comments)
|
||||
- [Development tips and tricks](#development-tips-and-tricks)
|
||||
- [Compiling for debugging](#compiling-for-debugging)
|
||||
- [Show sources in debugging](#show-sources-in-debugging)
|
||||
- [Compiling for gprof profiling](#compiling-for-gprof-profiling)
|
||||
- [`debug.log`](#debuglog)
|
||||
- [Testnet and Regtest modes](#testnet-and-regtest-modes)
|
||||
@ -84,6 +85,10 @@ code.
|
||||
- Class member variables have a `m_` prefix.
|
||||
- Global variables have a `g_` prefix.
|
||||
- Constant names are all uppercase, and use `_` to separate words.
|
||||
- Enumerator constants may be `snake_case`, `PascalCase` or `ALL_CAPS`.
|
||||
This is a more tolerant policy than the [C++ Core
|
||||
Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-caps),
|
||||
which recommend using `snake_case`. Please use what seems appropriate.
|
||||
- Class names, function names, and method names are UpperCamelCase
|
||||
(PascalCase). Do not prefix class names with `C`.
|
||||
- Test suite naming convention: The Boost test suite in file
|
||||
@ -211,6 +216,35 @@ Development tips and tricks
|
||||
Run configure with `--enable-debug` to add additional compiler flags that
|
||||
produce better debugging builds.
|
||||
|
||||
### Show sources in debugging
|
||||
|
||||
If you have ccache enabled, absolute paths are stripped from debug information
|
||||
with the -fdebug-prefix-map and -fmacro-prefix-map options (if supported by the
|
||||
compiler). This might break source file detection in case you move binaries
|
||||
after compilation, debug from the directory other than the project root or use
|
||||
an IDE that only supports absolute paths for debugging.
|
||||
|
||||
There are a few possible fixes:
|
||||
|
||||
1. Configure source file mapping.
|
||||
|
||||
For `gdb` create or append to `.gdbinit` file:
|
||||
```
|
||||
set substitute-path ./src /path/to/project/root/src
|
||||
```
|
||||
|
||||
For `lldb` create or append to `.lldbinit` file:
|
||||
```
|
||||
settings set target.source-map ./src /path/to/project/root/src
|
||||
```
|
||||
|
||||
2. Add a symlink to the `./src` directory:
|
||||
```
|
||||
ln -s /path/to/project/root/src src
|
||||
```
|
||||
|
||||
3. Use `debugedit` to modify debug information in the binary.
|
||||
|
||||
### Compiling for gprof profiling
|
||||
|
||||
Run configure with the `--enable-gprof` option, then make.
|
||||
@ -603,19 +637,19 @@ Foo(vec);
|
||||
|
||||
```cpp
|
||||
enum class Tabs {
|
||||
INFO,
|
||||
CONSOLE,
|
||||
GRAPH,
|
||||
PEERS
|
||||
info,
|
||||
console,
|
||||
network_graph,
|
||||
peers
|
||||
};
|
||||
|
||||
int GetInt(Tabs tab)
|
||||
{
|
||||
switch (tab) {
|
||||
case Tabs::INFO: return 0;
|
||||
case Tabs::CONSOLE: return 1;
|
||||
case Tabs::GRAPH: return 2;
|
||||
case Tabs::PEERS: return 3;
|
||||
case Tabs::info: return 0;
|
||||
case Tabs::console: return 1;
|
||||
case Tabs::network_graph: return 2;
|
||||
case Tabs::peers: return 3;
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
assert(false);
|
||||
}
|
||||
|
@ -921,11 +921,8 @@ if ENABLE_BIP70
|
||||
$(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(<D) $<
|
||||
endif
|
||||
|
||||
if EMBEDDED_LEVELDB
|
||||
include Makefile.crc32c.include
|
||||
include Makefile.leveldb.include
|
||||
endif
|
||||
|
||||
include Makefile.test_util.include
|
||||
|
||||
if ENABLE_TESTS
|
||||
|
@ -8,9 +8,10 @@ LIBMEMENV_INT = leveldb/libmemenv.a
|
||||
EXTRA_LIBRARIES += $(LIBLEVELDB_INT)
|
||||
EXTRA_LIBRARIES += $(LIBMEMENV_INT)
|
||||
|
||||
LIBLEVELDB += $(LIBLEVELDB_INT) $(LIBCRC32C)
|
||||
LIBMEMENV += $(LIBMEMENV_INT)
|
||||
LIBLEVELDB = $(LIBLEVELDB_INT) $(LIBCRC32C)
|
||||
LIBMEMENV = $(LIBMEMENV_INT)
|
||||
|
||||
LEVELDB_CPPFLAGS =
|
||||
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
|
||||
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <codecvt>
|
||||
#include <limits>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
*/
|
||||
bool Rewrite(const char* pszSkip=nullptr) override;
|
||||
|
||||
/** Indicate the a new database user has began using the database. */
|
||||
/** Indicate that a new database user has begun using the database. */
|
||||
void AddRef() override;
|
||||
/** Indicate that database user has stopped using the database and that it could be flushed or closed. */
|
||||
void RemoveRef() override;
|
||||
|
@ -265,7 +265,7 @@ def main():
|
||||
parser.add_argument('--keepcache', '-k', action='store_true', help='the default behavior is to flush the cache directory on startup. --keepcache retains the cache from the previous testrun.')
|
||||
parser.add_argument('--quiet', '-q', action='store_true', help='only print dots, results summary and failure logs')
|
||||
parser.add_argument('--tmpdirprefix', '-t', default=tempfile.gettempdir(), help="Root directory for datadirs")
|
||||
parser.add_argument('--failfast', action='store_true', help='stop execution after the first test failure')
|
||||
parser.add_argument('--failfast', '-F', action='store_true', help='stop execution after the first test failure')
|
||||
parser.add_argument('--filter', help='filter scripts to run by regular expression')
|
||||
args, unknown_args = parser.parse_known_args()
|
||||
|
||||
|
@ -123,6 +123,14 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||
assert_equal(newbalance, balance + Decimal("30"))
|
||||
balance = newbalance
|
||||
|
||||
self.log.info("Check abandoned transactions in listsinceblock")
|
||||
listsinceblock = self.nodes[0].listsinceblock()
|
||||
txAB1_listsinceblock = [d for d in listsinceblock['transactions'] if d['txid'] == txAB1 and d['category'] == 'send']
|
||||
for tx in txAB1_listsinceblock:
|
||||
assert_equal(tx['abandoned'], True)
|
||||
assert_equal(tx['confirmations'], 0)
|
||||
assert_equal(tx['trusted'], False)
|
||||
|
||||
# Verify that even with a low min relay fee, the tx is not reaccepted from wallet on startup once abandoned
|
||||
self.stop_node(0)
|
||||
self.start_node(0, extra_args=["-minrelaytxfee=0.00001"])
|
||||
@ -154,6 +162,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||
assert_equal(newbalance, balance - Decimal("24.9996"))
|
||||
balance = newbalance
|
||||
|
||||
self.log.info("Test transactions conflicted by a double spend")
|
||||
# Create a double spend of AB1 by spending again from only A's 10 output
|
||||
# Mine double spend from node 1
|
||||
inputs = []
|
||||
@ -168,6 +177,34 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
self.sync_blocks()
|
||||
|
||||
tx_list = self.nodes[0].listtransactions()
|
||||
|
||||
conflicted = [tx for tx in tx_list if tx["confirmations"] < 0]
|
||||
assert_equal(4, len(conflicted))
|
||||
|
||||
wallet_conflicts = [tx for tx in conflicted if tx["walletconflicts"]]
|
||||
assert_equal(2, len(wallet_conflicts))
|
||||
|
||||
double_spends = [tx for tx in tx_list if tx["walletconflicts"] and tx["confirmations"] > 0]
|
||||
assert_equal(1, len(double_spends))
|
||||
double_spend = double_spends[0]
|
||||
|
||||
# Test the properties of the conflicted transactions, i.e. with confirmations < 0.
|
||||
for tx in conflicted:
|
||||
assert_equal(tx["abandoned"], False)
|
||||
assert_equal(tx["confirmations"], -1)
|
||||
assert_equal(tx["trusted"], False)
|
||||
|
||||
# Test the properties of the double-spend transaction, i.e. having wallet conflicts and confirmations > 0.
|
||||
assert_equal(double_spend["abandoned"], False)
|
||||
assert_equal(double_spend["confirmations"], 1)
|
||||
assert "trusted" not in double_spend.keys() # "trusted" only returned if tx has 0 or negative confirmations.
|
||||
|
||||
# Test the walletconflicts field of each.
|
||||
for tx in wallet_conflicts:
|
||||
assert_equal(double_spend["walletconflicts"], [tx["txid"]])
|
||||
assert_equal(tx["walletconflicts"], [double_spend["txid"]])
|
||||
|
||||
# Verify that B and C's 10 BTC outputs are available for spending again because AB1 is now conflicted
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert_equal(newbalance, balance + Decimal("20"))
|
||||
@ -181,7 +218,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||
#assert_equal(newbalance, balance - Decimal("10"))
|
||||
self.log.info("If balance has not declined after invalidateblock then out of mempool wallet tx which is no longer")
|
||||
self.log.info("conflicted has not resumed causing its inputs to be seen as spent. See Issue #7315")
|
||||
self.log.info(str(balance) + " -> " + str(newbalance) + " ?")
|
||||
assert_equal(balance, newbalance)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user