Skip to content

Commit

Permalink
Merge #9011: 0.13.2 backports
Browse files Browse the repository at this point in the history
b16cdb7 Add MIT license to build-aux/m4 scripts (Luke Dashjr)
2cfcca7 Trivial: build-aux/m4/l_atomic: Fix typo (Luke Dashjr)
fa58e55 Add MIT license to autogen.sh and share/genbuild.sh (Luke Dashjr)
6d05fe1 Add MIT license to Makefiles (Luke Dashjr)
1d048b9 Don't return the address of a P2SH of a P2SH. (jnewbery)
ce0d817 Fix relaypriority calculation error (maiiz)
9ef3875 Add missing cs_main lock to ::GETBLOCKTXN processing (Matt Corallo)
  • Loading branch information
laanwj committed Nov 2, 2016
2 parents 2e2388a + b16cdb7 commit 59ce53c
Show file tree
Hide file tree
Showing 16 changed files with 68 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Makefile.am
@@ -1,3 +1,7 @@
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

ACLOCAL_AMFLAGS = -I build-aux/m4
SUBDIRS = src
.PHONY: deploy FORCE
Expand Down
4 changes: 4 additions & 0 deletions autogen.sh
@@ -1,4 +1,8 @@
#!/bin/sh
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

set -e
srcdir="$(dirname $0)"
cd "$srcdir"
Expand Down
4 changes: 4 additions & 0 deletions build-aux/m4/bitcoin_find_bdb48.m4
@@ -1,3 +1,7 @@
dnl Copyright (c) 2013-2015 The Bitcoin Core developers
dnl Distributed under the MIT software license, see the accompanying
dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.

AC_DEFUN([BITCOIN_FIND_BDB48],[
AC_MSG_CHECKING([for Berkeley DB C++ headers])
BDB_CPPFLAGS=
Expand Down
4 changes: 4 additions & 0 deletions build-aux/m4/bitcoin_qt.m4
@@ -1,3 +1,7 @@
dnl Copyright (c) 2013-2016 The Bitcoin Core developers
dnl Distributed under the MIT software license, see the accompanying
dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.

dnl Helper for cases where a qt dependency is not met.
dnl Output: If qt version is auto, set bitcoin_enable_qt to false. Else, exit.
AC_DEFUN([BITCOIN_QT_FAIL],[
Expand Down
4 changes: 4 additions & 0 deletions build-aux/m4/bitcoin_subdir_to_include.m4
@@ -1,3 +1,7 @@
dnl Copyright (c) 2013-2014 The Bitcoin Core developers
dnl Distributed under the MIT software license, see the accompanying
dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.

dnl BITCOIN_SUBDIR_TO_INCLUDE([CPPFLAGS-VARIABLE-NAME],[SUBDIRECTORY-NAME],[HEADER-FILE])
dnl SUBDIRECTORY-NAME must end with a path separator
AC_DEFUN([BITCOIN_SUBDIR_TO_INCLUDE],[
Expand Down
8 changes: 7 additions & 1 deletion build-aux/m4/l_atomic.m4
@@ -1,3 +1,9 @@
dnl Copyright (c) 2015 Tim Kosse <tim.kosse@filezilla-project.org>
dnl Copying and distribution of this file, with or without modification, are
dnl permitted in any medium without royalty provided the copyright notice
dnl and this notice are preserved. This file is offered as-is, without any
dnl warranty.

# Some versions of gcc/libstdc++ require linking with -latomic if
# using the C++ atomic library.
#
Expand Down Expand Up @@ -32,7 +38,7 @@ AC_DEFUN([CHECK_ATOMIC], [
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_FAILURE([cannot figure our how to use std::atomic])
AC_MSG_FAILURE([cannot figure out how to use std::atomic])
])
])
Expand Down
4 changes: 4 additions & 0 deletions share/genbuild.sh
@@ -1,4 +1,8 @@
#!/bin/sh
# Copyright (c) 2012-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

if [ $# -gt 1 ]; then
cd "$2"
fi
Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.am
@@ -1,3 +1,7 @@
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

DIST_SUBDIRS = secp256k1 univalue

AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS)
Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.bench.include
@@ -1,3 +1,7 @@
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

bin_PROGRAMS += bench/bench_bitcoin
BENCH_SRCDIR = bench
BENCH_BINARY = bench/bench_bitcoin$(EXEEXT)
Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.leveldb.include
@@ -1,3 +1,7 @@
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

LIBLEVELDB_INT = leveldb/libleveldb.a
LIBMEMENV_INT = leveldb/libmemenv.a

Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.qt.include
@@ -1,3 +1,7 @@
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

bin_PROGRAMS += qt/bitcoin-qt
EXTRA_LIBRARIES += qt/libbitcoinqt.a

Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.qttest.include
@@ -1,3 +1,7 @@
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

bin_PROGRAMS += qt/test/test_bitcoin-qt
TESTS += qt/test/test_bitcoin-qt

Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.test.include
@@ -1,3 +1,7 @@
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

TESTS += test/test_bitcoin
bin_PROGRAMS += test/test_bitcoin
TEST_SRCDIR = test
Expand Down
2 changes: 1 addition & 1 deletion src/coins.cpp
Expand Up @@ -275,7 +275,7 @@ double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight, CAmount
assert(coins);
if (!coins->IsAvailable(txin.prevout.n)) continue;
if (coins->nHeight <= nHeight) {
dResult += coins->vout[txin.prevout.n].nValue * (nHeight-coins->nHeight);
dResult += (double)(coins->vout[txin.prevout.n].nValue) * (nHeight-coins->nHeight);
inChainInputValue += coins->vout[txin.prevout.n].nValue;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Expand Up @@ -5388,6 +5388,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
BlockTransactionsRequest req;
vRecv >> req;

LOCK(cs_main);

BlockMap::iterator it = mapBlockIndex.find(req.blockhash);
if (it == mapBlockIndex.end() || !(it->second->nStatus & BLOCK_HAVE_DATA)) {
LogPrintf("Peer %d sent us a getblocktxn for a block we don't have", pfrom->id);
Expand Down
12 changes: 10 additions & 2 deletions src/rpc/rawtransaction.cpp
Expand Up @@ -535,7 +535,7 @@ UniValue decodescript(const UniValue& params, bool fHelp)
" \"address\" (string) bitcoin address\n"
" ,...\n"
" ],\n"
" \"p2sh\",\"address\" (string) script address\n"
" \"p2sh\",\"address\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("decodescript", "\"hexstring\"")
Expand All @@ -554,7 +554,15 @@ UniValue decodescript(const UniValue& params, bool fHelp)
}
ScriptPubKeyToJSON(script, r, false);

r.push_back(Pair("p2sh", CBitcoinAddress(CScriptID(script)).ToString()));
UniValue type;
type = find_value(r, "type");

if (type.isStr() && type.get_str() != "scripthash") {
// P2SH cannot be wrapped in a P2SH. If this script is already a P2SH,
// don't return the address for a P2SH of the P2SH.
r.push_back(Pair("p2sh", CBitcoinAddress(CScriptID(script)).ToString()));
}

return r;
}

Expand Down

0 comments on commit 59ce53c

Please sign in to comment.