From b72d06c4a8fed0a9a4f55a61a86e9686c5de9d26 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Thu, 31 Oct 2024 00:10:00 -0400 Subject: [PATCH 1/6] Avoid assigning shared ptr dereference to reference. --- src/messages/transaction.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/messages/transaction.cpp b/src/messages/transaction.cpp index 5005b8ad3..806bb9227 100644 --- a/src/messages/transaction.cpp +++ b/src/messages/transaction.cpp @@ -45,22 +45,22 @@ typename transaction::cptr transaction::deserialize(uint32_t version, if (!reader) return nullptr; - const auto& tx = *message->transaction_ptr; + const auto& tx = message->transaction_ptr; // Cache transaction hashes. // If !witness then wire txs cannot have been segregated. - if (tx.is_segregated()) + if (tx->is_segregated()) { - const auto true_size = tx.serialized_size(true); - const auto false_size = tx.serialized_size(false); - tx.set_witness_hash(bitcoin_hash(true_size, data.data())); - tx.set_nominal_hash(chain::transaction::desegregated_hash( + const auto true_size = tx->serialized_size(true); + const auto false_size = tx->serialized_size(false); + tx->set_witness_hash(bitcoin_hash(true_size, data.data())); + tx->set_nominal_hash(chain::transaction::desegregated_hash( true_size, false_size, data.data())); } else { - const auto false_size = tx.serialized_size(false); - tx.set_nominal_hash(bitcoin_hash(false_size, data.data())); + const auto false_size = tx->serialized_size(false); + tx->set_nominal_hash(bitcoin_hash(false_size, data.data())); } return message; From 0e035aa70fb3b5069e4ac55c938f4903cfc6e828 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 28 Oct 2024 21:32:09 -0400 Subject: [PATCH 2/6] git.ignore /build directory. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4af7cb777..15f1e2a95 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ libbitcoin-network.pc bin obj +build .*.swp *~ /*.kdev4 From 016d3b8bebc1d99a8a12a130568694af17e08188 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 28 Oct 2024 21:33:14 -0400 Subject: [PATCH 3/6] Initial tasks.json and launch.json (presets). --- .vscode/launch.json | 32 ++++++++++++++++++++++++++++++++ .vscode/tasks.json | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..e67097c98 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,32 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/obj/nix-gnu-debug-static/libbitcoin-network-test", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/obj/nix-gnu-debug-static", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..66f3c26a7 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,34 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "cmake", + "label": "CMake: build", + "command": "build", + "targets": [ + "bitcoin-network", + "libbitcoin-network-test" + ], + "preset": "${command:cmake.activeBuildPresetName}", + "group": "build", + "problemMatcher": [], + "detail": "CMake template build task" + }, + { + "type": "cmake", + "label": "CMake: clean", + "command": "clean", + "preset": "${command:cmake.activeBuildPresetName}", + "problemMatcher": [], + "detail": "CMake template clean task" + }, + { + "type": "cmake", + "label": "CMake: install", + "command": "install", + "preset": "${command:cmake.activeBuildPresetName}", + "problemMatcher": [], + "detail": "CMake template install task" + } + ] +} \ No newline at end of file From 6d718e8752ddc01b6cfe675e95201dc97d00a368 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 28 Oct 2024 21:47:48 -0400 Subject: [PATCH 4/6] Add workspace file for vscode. --- builds/vscode/network.code-workspace | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 builds/vscode/network.code-workspace diff --git a/builds/vscode/network.code-workspace b/builds/vscode/network.code-workspace new file mode 100644 index 000000000..6668a2a22 --- /dev/null +++ b/builds/vscode/network.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "../../../libbitcoin-system" + }, + { + "path": "../../../libbitcoin-network" + } + ], + "settings": {} +} From 9156161959efcc8cc70fdbe62e7f5cf60d49d726 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 28 Oct 2024 21:32:29 -0400 Subject: [PATCH 5/6] Update presets relative path. --- builds/cmake/CMakePresets.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builds/cmake/CMakePresets.json b/builds/cmake/CMakePresets.json index 5dacb0f59..6b3879bfc 100644 --- a/builds/cmake/CMakePresets.json +++ b/builds/cmake/CMakePresets.json @@ -5,7 +5,7 @@ "name": "nix-base", "description": "Factored base settings for non-windows *nix based platforms.", "hidden": true, - "installDir": "${sourceParentDir}/../../prefix/${presetName}", + "installDir": "${sourceParentDir}/../../../prefix/${presetName}", "binaryDir": "${sourceParentDir}/../obj/${presetName}", "condition": { "type": "inList", @@ -18,11 +18,11 @@ "cacheVariables": { "CMAKE_PREFIX_PATH": { "type": "PATH", - "value": "${sourceParentDir}/../../prefix/${presetName}" + "value": "${sourceParentDir}/../../../prefix/${presetName}" }, "CMAKE_LIBRARY_PATH": { "type": "PATH", - "value": "${sourceParentDir}/../../prefix/${presetName}/lib:$env{CMAKE_LIBRARY_PATH}" + "value": "${sourceParentDir}/../../../prefix/${presetName}/lib:$env{CMAKE_LIBRARY_PATH}" } } }, From 911070d5a88251ffa58fc77af70fbc56ca001991 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 28 Oct 2024 21:32:51 -0400 Subject: [PATCH 6/6] Add "cmake.useCMakePresets": "always" to a settings.json. --- .vscode/settings.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..dd9c384e2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "cmake.sourceDirectory": "/home/nixmini/Repository/Source/libbitcoin-network/builds/cmake", + "cmake.useCMakePresets": "always" +} \ No newline at end of file