Browse Source

Various updates

pull/5/head
Duke Leto 3 years ago
parent
commit
4fd9ae6f94
  1. 4
      src/support/allocators/secure.h
  2. 10
      src/support/allocators/zeroafterfree.h
  3. 5
      src/test/bctest.py
  4. 13
      src/test/data/README.md
  5. 25
      src/test/wallet-utility.py
  6. 6
      src/wallet/test/wallet_tests.cpp

4
src/support/allocators/secure.h

@ -8,13 +8,9 @@
#define HUSH_SUPPORT_ALLOCATORS_SECURE_H
#include "support/pagelocker.h"
#include <string>
//
// Allocator that locks its contents from being paged
// out of memory and clears its contents before deletion.
//
template <typename T>
struct secure_allocator : public std::allocator<T> {
// MSVC8 default copy constructor is broken

10
src/support/allocators/zeroafterfree.h

@ -1,13 +1,13 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
#ifndef BITCOIN_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H
#define BITCOIN_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H
#ifndef HUSH_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H
#define HUSH_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H
#include "support/cleanse.h"
#include <memory>
#include <vector>
@ -45,4 +45,4 @@ struct zero_after_free_allocator : public std::allocator<T> {
// Byte-vector that clears its contents before deletion.
typedef std::vector<char, zero_after_free_allocator<char> > CSerializeData;
#endif // BITCOIN_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H
#endif // HUSH_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H

5
src/test/bctest.py

@ -1,6 +1,7 @@
# Copyright 2014 BitPay, Inc.
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php
# Copyright (c) 2019-2020 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
import subprocess
import json

13
src/test/data/README.md

@ -1,12 +1,9 @@
Description
------------
# Data-Driven Hush Tests
This directory contains data-driven tests for various aspects of Bitcoin.
This directory contains data-driven tests for various aspects of Hush
License
--------
# License
The data files in this directory are distributed under the MIT software
license, see the accompanying file COPYING or
https://www.opensource.org/licenses/mit-license.php
Distributed under the GPLv3 software license, see the accompanying
file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

25
src/test/wallet-utility.py

@ -1,7 +1,8 @@
#!/usr/bin/python
# Copyright 2014 BitPay, Inc.
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php
# Copyright (c) 2019-2020 The Hush developers
## Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
import subprocess
import os
@ -29,9 +30,9 @@ if __name__ == '__main__':
output = json.loads(outs[0])
assert_equal(output[0], "13EngsxkRi7SJPPqCyJsKf34U8FoX9E9Av")
assert_equal(output[1], "1FKCLGTpPeYBUqfNxktck8k5nqxB8sjim8")
assert_equal(output[2], "13cdtE9tnNeXCZJ8KQ5WELgEmLSBLnr48F")
assert_equal(output[0], "R3EngsxkRi7SJPPqCyJsKf34U8FoX9E9Av")
assert_equal(output[1], "RFKCLGTpPeYBUqfNxktck8k5nqxB8sjim8")
assert_equal(output[2], "R3cdtE9tnNeXCZJ8KQ5WELgEmLSBLnr48F")
execargs = '-datadir=' + datadir + ' -dumppass'
execrun = execprog + ' ' + execargs
@ -45,12 +46,12 @@ if __name__ == '__main__':
output = json.loads(outs[0])
assert_equal(output[0]['addr'], "13EngsxkRi7SJPPqCyJsKf34U8FoX9E9Av")
assert_equal(output[0]['pkey'], "5Jz5BWE2WQxp1hGqDZeisQFV1mRFR2AVBAgiXCbNcZyXNjD9aUd")
assert_equal(output[1]['addr'], "1FKCLGTpPeYBUqfNxktck8k5nqxB8sjim8")
assert_equal(output[1]['pkey'], "5HsX2b3v2GjngYQ5ZM4mLp2b2apw6aMNVaPELV1YmpiYR1S4jzc")
assert_equal(output[2]['addr'], "13cdtE9tnNeXCZJ8KQ5WELgEmLSBLnr48F")
assert_equal(output[2]['pkey'], "5KCWAs1wX2ESiL4PfDR8XYVSSETHFd2jaRGxt1QdanBFTit4XcH")
assert_equal(output[0]['addr'], "R3EngsxkRi7SJPPqCyJsKf34U8FoX9E9Av")
assert_equal(output[0]['pkey'], "UJz5BWE2WQxp1hGqDZeisQFV1mRFR2AVBAgiXCbNcZyXNjD9aUd")
assert_equal(output[1]['addr'], "RFKCLGTpPeYBUqfNxktck8k5nqxB8sjim8")
assert_equal(output[1]['pkey'], "UHsX2b3v2GjngYQ5ZM4mLp2b2apw6aMNVaPELV1YmpiYR1S4jzc")
assert_equal(output[2]['addr'], "R3cdtE9tnNeXCZJ8KQ5WELgEmLSBLnr48F")
assert_equal(output[2]['pkey'], "UKCWAs1wX2ESiL4PfDR8XYVSSETHFd2jaRGxt1QdanBFTit4XcH")
if os.path.exists(datadir + '/database'):
if os.path.isdir(datadir + '/database'):
@ -58,4 +59,4 @@ if __name__ == '__main__':
if os.path.exists(datadir + '/db.log'):
os.remove(datadir + '/db.log')
sys.exit(0)
sys.exit(0)

6
src/wallet/test/wallet_tests.cpp

@ -1,16 +1,14 @@
// Copyright (c) 2012-2014 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
#include "wallet/wallet.h"
#include <set>
#include <stdint.h>
#include <utility>
#include <vector>
#include "test/test_bitcoin.h"
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>

Loading…
Cancel
Save