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 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/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 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 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}" } } }, 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": {} +} 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;