Commit f3cbe127 authored by Joeldo Holanda's avatar Joeldo Holanda

Iss47

parent 13c92649
Contributing to MERGE Core
Contributing to Merge Core
==========================
The MERGE Core project operates an open contributor model where anyone is
The Merge Core project operates an open contributor model where anyone is
welcome to contribute towards development in the form of peer review, testing
and patches. This document explains the practical process and guidelines for
contributing.
......@@ -57,12 +57,12 @@ the pull request affects. Valid areas as:
- *Consensus* for changes to consensus critical code
- *Docs* for changes to the documentation
- *Qt* for changes to MERGE-qt
- *Qt* for changes to merge-qt
- *Minting* for changes to the minting code
- *Net* or *P2P* for changes to the peer-to-peer network code
- *RPC/REST* for changes to the RPC or REST APIs
- *Scripts and tools* for changes to the scripts and tools
- *Tests* for changes to the merge unit tests or QA tests
- *Tests* for changes to The Merge unit tests or QA tests
- *Trivial* should **only** be used for PRs that do not change generated
executable code. Notably, refactors (change of function arguments and code
reorganization) and changes in behavior should **not** be marked as trivial.
......@@ -157,10 +157,10 @@ where possible keep them short, un-complex and easy to verify.
"Decision Making" Process
-------------------------
The following applies to code changes to the MERGE Core project, and is not to be
The following applies to code changes to The Merge Core project, and is not to be
confused with overall MERGE Network Protocol consensus changes.
Whether a pull request is merged into MERGE Core rests with the project merge
Whether a pull request is merged into Merge Core rests with the project merge
maintainers and ultimately the project lead.
Maintainers will take into consideration if a patch is in line with the general
......@@ -214,7 +214,7 @@ higher in terms of discussion and peer review requirements, keeping in mind that
mistakes could be very costly to the wider community. This includes refactoring
of consensus critical code.
Where a patch set proposes to change the MERGE consensus, it must have been
Where a patch set proposes to change The Merge consensus, it must have been
discussed extensively on the forums and Slack, be accompanied by a widely
discussed Proposal and have a generally widely perceived technical consensus of being
a worthwhile change based on the judgement of the maintainers.
......@@ -254,7 +254,7 @@ about:
Release Policy
--------------
The project leader is the release manager for each MERGE Core release.
The project leader is the release manager for each Merge Core release.
Copyright
---------
......
......@@ -14,7 +14,7 @@ BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EX
empty :=
space := $(empty) $(empty)
OSX_APP=MERGE-Qt.app
OSX_APP=Merge-Qt.app
OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
OSX_DMG = $(OSX_VOLNAME).dmg
OSX_BACKGROUND_SVG=background.svg
......@@ -80,7 +80,7 @@ $(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
$(MKDIR_P) $(@D)
$(INSTALL_DATA) $< $@
$(OSX_APP)/Contents/MacOS/MERGE-Qt: $(BITCOIN_QT_BIN)
$(OSX_APP)/Contents/MacOS/Merge-Qt: $(BITCOIN_QT_BIN)
$(MKDIR_P) $(@D)
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@
......@@ -90,7 +90,7 @@ $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings:
OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
$(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
$(OSX_APP)/Contents/MacOS/MERGE-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
$(OSX_APP)/Contents/MacOS/Merge-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
osx_volname:
echo $(OSX_VOLNAME) >$@
......@@ -115,7 +115,7 @@ $(APP_DIST_DIR)/Applications:
@rm -f $@
@cd $(@D); $(LN_S) /Applications $(@F)
$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/MERGE-Qt
$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Merge-Qt
$(OSX_DMG): $(APP_DIST_EXTRAS)
$(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -apple -o $@ dist
......@@ -130,7 +130,7 @@ $(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): $(OSX_BACKGROUND_IMAGE_DPIF
$(APP_DIST_DIR)/.DS_Store: $(OSX_DSSTORE_GEN)
$(PYTHON) $< "$@" "$(OSX_VOLNAME)"
$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/MERGE-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Merge-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
deploydir: $(APP_DIST_EXTRAS)
......
......@@ -7,7 +7,7 @@ dnl Output: If qt version is auto, set bitcoin_enable_qt to false. Else, exit.
AC_DEFUN([BITCOIN_QT_FAIL],[
if test "x$bitcoin_qt_want_version" = "xauto" && test x$bitcoin_qt_force != xyes; then
if test x$bitcoin_enable_qt != xno; then
AC_MSG_WARN([$1; MERGE-qt frontend will not be built])
AC_MSG_WARN([$1; merge-qt frontend will not be built])
fi
bitcoin_enable_qt=no
bitcoin_enable_qt_test=no
......@@ -54,7 +54,7 @@ AC_DEFUN([BITCOIN_QT_INIT],[
dnl enable qt support
AC_ARG_WITH([gui],
[AS_HELP_STRING([--with-gui@<:@=no|qt4|qt5|auto@:>@],
[build MERGE-qt GUI (default=auto, qt5 tried first)])],
[build merge-qt GUI (default=auto, qt5 tried first)])],
[
bitcoin_qt_want_version=$withval
if test x$bitcoin_qt_want_version = xyes; then
......
......@@ -6,16 +6,16 @@ define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2018)
AC_INIT([MERGE Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[www.projectmerge.org],[MERGE])
AC_INIT([Merge Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[www.projectmerge.org],[MERGE])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([src/config/merge-config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux/m4])
BITCOIN_DAEMON_NAME=MERGEd
BITCOIN_GUI_NAME=MERGE-qt
BITCOIN_CLI_NAME=MERGE-cli
BITCOIN_TX_NAME=MERGE-tx
BITCOIN_DAEMON_NAME=merged
BITCOIN_GUI_NAME=merge-qt
BITCOIN_CLI_NAME=merge-cli
BITCOIN_TX_NAME=merge-tx
AC_CANONICAL_HOST
......@@ -192,7 +192,7 @@ CPPFLAGS="$CPPFLAGS -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_
AC_ARG_WITH([utils],
[AS_HELP_STRING([--with-utils],
[build MERGE-cli MERGE-tx (default=yes)])],
[build merge-cli merge-tx (default=yes)])],
[build_bitcoin_utils=$withval],
[build_bitcoin_utils=yes])
......@@ -204,7 +204,7 @@ AC_ARG_WITH([libs],
AC_ARG_WITH([daemon],
[AS_HELP_STRING([--with-daemon],
[build MERGEd daemon (default=yes)])],
[build merged daemon (default=yes)])],
[build_bitcoind=$withval],
[build_bitcoind=yes])
......@@ -798,11 +798,11 @@ LIBS="$LIBS_TEMP"
BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],$protoc_bin_path)
AC_MSG_CHECKING([whether to build MERGEd])
AC_MSG_CHECKING([whether to build merged])
AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes])
AC_MSG_RESULT($build_bitcoind)
AC_MSG_CHECKING([whether to build utils (MERGE-cli MERGE-tx)])
AC_MSG_CHECKING([whether to build utils (merge-cli merge-tx)])
AM_CONDITIONAL([BUILD_BITCOIN_UTILS], [test x$build_bitcoin_utils = xyes])
AC_MSG_RESULT($build_bitcoin_utils)
......@@ -902,7 +902,7 @@ if test x$bitcoin_enable_qt != xno; then
AC_MSG_WARN("xgettext is required to update qt translations")
fi
AC_MSG_CHECKING([whether to build test_MERGE-qt])
AC_MSG_CHECKING([whether to build test_merge-qt])
if test x$use_tests$bitcoin_enable_qt_test = xyesyes; then
AC_MSG_RESULT([yes])
BUILD_TEST_QT="test"
......
......@@ -374,7 +374,7 @@ SOURCES += src/activemasternode.cpp \
src/obfuscation-relay.cpp \
src/obfuscation.cpp \
src/MERGE-cli.cpp \
src/MERGE-tx.cpp \
src/merge-tx.cpp \
src/MERGE.cpp \
src/db.cpp \
src/eccryptoverify.cpp \
......
......@@ -4,7 +4,7 @@ Name=MERGE
Comment=MERGE P2P Cryptocurrency
Comment[fr]=MERGE, monnaie virtuelle cryptographique pair à pair
Comment[tr]=MERGE, eşten eşe kriptografik sanal para birimi
Exec=MERGE-qt %u
Exec=merge-qt %u
Terminal=false
Type=Application
Icon=MERGE128
......
usr/local/bin/MERGE-qt usr/bin
usr/local/bin/merge-qt usr/bin
share/pixmaps/bitcoin32.xpm usr/share/pixmaps
share/pixmaps/bitcoin16.xpm usr/share/pixmaps
share/pixmaps/bitcoin128.png usr/share/pixmaps
debian/MERGE-qt.desktop usr/share/applications
debian/MERGE-qt.protocol usr/share/kde4/services/
debian/merge-qt.desktop usr/share/applications
debian/merge-qt.protocol usr/share/kde4/services/
# Linked code is Expat - only Debian packaging is GPL-2+
MERGE-qt: possible-gpl-code-linked-with-openssl
merge-qt: possible-gpl-code-linked-with-openssl
[Protocol]
exec=MERGE-qt '%u'
exec=merge-qt '%u'
protocol=MERGE
input=none
output=none
......
Debian
====================
This directory contains files used to package MERGEd/MERGE-qt
for Debian-based Linux systems. If you compile MERGEd/MERGE-qt yourself, there are some useful files here.
This directory contains files used to package merged/merge-qt
for Debian-based Linux systems. If you compile merged/merge-qt yourself, there are some useful files here.
## MERGE: URI support ##
MERGE-qt.desktop (Gnome / Open Desktop)
merge-qt.desktop (Gnome / Open Desktop)
To install:
sudo desktop-file-install MERGE-qt.desktop
sudo desktop-file-install merge-qt.desktop
sudo update-desktop-database
If you build yourself, you will either need to modify the paths in
the .desktop file or copy or symlink your MERGEqt binary to `/usr/bin`
and the `../../share/pixmaps/MERGE128.png` to `/usr/share/pixmaps`
MERGE-qt.protocol (KDE)
merge-qt.protocol (KDE)
......@@ -365,8 +365,8 @@ bitcoin (0.3.19~dfsg-5) unstable; urgency=low
bitcoin (0.3.19~dfsg-4) unstable; urgency=low
[ Micah Anderson ]
* Provide example MERGE.conf.
* Add bitcoind(1) and MERGE.conf(5) man pages.
* Provide example merge.conf.
* Add bitcoind(1) and merge.conf(5) man pages.
[ Jonas Smedegaard ]
* Ease backporting:
......
Source: MERGE
Source: merge
Section: utils
Priority: optional
Maintainer: Jonas Smedegaard <dr@jones.dk> ***TODO***
......@@ -22,15 +22,15 @@ Build-Depends: debhelper,
libqrencode-dev,
libprotobuf-dev, protobuf-compiler
Standards-Version: 3.9.2
Homepage: http://www.MERGE.org
Vcs-Git: git://github.com/PIVX-Project/PIVX.git
Vcs-Browser: http://github.com/PIVX-Project/PIVX
Homepage: http://www.projectmerge.org
Vcs-Git: git://github.com/ProjectMerge/merge.git
Vcs-Browser: https://github.com/ProjectMerge/merge
Package: MERGEd
Package: merged
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: peer-to-peer network based digital currency - daemon
MERGE is a free open source peer-to-peer electronic cash system that
Merge is a free open source peer-to-peer electronic cash system that
is completely decentralized, without the need for a central server or
trusted parties. Users hold the crypto keys to their own money and
transact directly with each other, with the help of a P2P network to
......@@ -39,14 +39,14 @@ Description: peer-to-peer network based digital currency - daemon
Full transaction history is stored locally at each client. This
requires 1+ GB of space, slowly growing.
.
This package provides the daemon, MERGEd, and the CLI tool
MERGE-cli to interact with the daemon.
This package provides the daemon, merged, and the CLI tool
merge-cli to interact with the daemon.
Package: MERGE-qt
Package: merge-qt
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: peer-to-peer network based digital currency - Qt GUI
MERGE is a free open source peer-to-peer electronic cash system that
Merge is a free open source peer-to-peer electronic cash system that
is completely decentralized, without the need for a central server or
trusted parties. Users hold the crypto keys to their own money and
transact directly with each other, with the help of a P2P network to
......@@ -55,4 +55,4 @@ Description: peer-to-peer network based digital currency - Qt GUI
Full transaction history is stored locally at each client. This
requires 1+ GB of space, slowly growing.
.
This package provides MERGE-Qt, a GUI for MERGE based on Qt.
This package provides Merge-Qt, a GUI for Merge based on Qt.
.TH PIV-QT "1" "February 2017" "MERGE-qt 1"
.TH PIV-QT "1" "February 2017" "merge-qt 1"
.SH NAME
MERGE-qt \- peer-to-peer network based digital currency
merge-qt \- peer-to-peer network based digital currency
.SH DESCRIPTION
.SS "Usage:"
.IP
......
......@@ -22,11 +22,11 @@ PIVX-Project/PIVX repository.
What it does:
* Fetch master and the pull request.
* Locally construct a merge commit.
* Locally construct a Merge commit.
* Show the diff that merge results in.
* Ask you to verify the resulting source tree (so you can do a make
check or whatever).
* Ask you whether to GPG sign the merge commit.
* Ask you whether to GPG sign The Merge commit.
* Ask you whether to push the result upstream.
This means that there are no potential race conditions (where a
......
......@@ -3,7 +3,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# This script will locally construct a merge commit for a pull request on a
# This script will locally construct a Merge commit for a pull request on a
# github repository, inspect it, sign it and optionally push it.
# The following temporary branches are created/overwritten and deleted:
......@@ -290,7 +290,7 @@ def main():
if os.path.isfile('/etc/debian_version'): # Show pull number on Debian default prompt
os.putenv('debian_chroot',pull)
subprocess.call([BASH,'-i'])
reply = ask_prompt("Type 'm' to accept the merge.")
reply = ask_prompt("Type 'm' to accept The Merge.")
if reply.lower() == 'm':
print("Merge accepted.",file=stderr)
else:
......@@ -302,8 +302,8 @@ def main():
print("ERROR: Tree hash changed unexpectedly",file=stderr)
exit(8)
# Sign the merge commit.
reply = ask_prompt("Type 's' to sign off on the merge.")
# Sign The Merge commit.
reply = ask_prompt("Type 's' to sign off on The Merge.")
if reply == 's':
try:
subprocess.check_call([GIT,'commit','-q','--gpg-sign','--amend','--no-edit'])
......
......@@ -17,7 +17,7 @@ osx=true
SIGNER=
VERSION=
commit=false
url=https://github.com/MERGE-project/MERGE
url=https://github.com/ProjectMerge/merge
proc=2
mem=2000
lxc=true
......@@ -31,7 +31,7 @@ commitFiles=true
read -d '' usage <<- EOF
Usage: $scriptName [-c|u|v|b|s|B|o|h|j|m|] signer version
Run this script from the directory containing the MERGE, gitian-builder, gitian.sigs, and MERGE-detached-sigs.
Run this script from the directory containing The Merge, gitian-builder, gitian.sigs, and Merge-detached-sigs.
Arguments:
signer GPG signer to sign each build assert file
......@@ -39,7 +39,7 @@ version Version number, commit, or branch to build. If building a commit or bra
Options:
-c|--commit Indicate that the version argument is for a commit or branch
-u|--url Specify the URL of the repository. Default is https://github.com/MERGE-project/MERGE
-u|--url Specify the URL of the repository. Default is https://github.com/ProjectMerge/merge
-v|--verify Verify the gitian build
-b|--build Do a gitian build
-s|--sign Make signed binaries for Windows and Mac OSX
......@@ -237,8 +237,8 @@ echo ${COMMIT}
if [[ $setup = true ]]
then
sudo apt-get install ruby apache2 git apt-cacher-ng python-vm-builder qemu-kvm qemu-utils
git clone https://github.com/MERGE-project/gitian.sigs.git
git clone https://github.com/MERGE-project/MERGE-detached-sigs.git
git clone https://github.com/ProjectMerge/gitian.sigs.git
git clone https://github.com/ProjectMerge/merge-detached-sigs.git
git clone https://github.com/devrandom/gitian-builder.git
pushd ./gitian-builder
if [[ -n "$USE_LXC" ]]
......
......@@ -33,5 +33,5 @@ script: |
tar -xf ${UNSIGNED}
OSX_VOLNAME="$(cat osx_volname)"
./detached-sig-apply.sh ${UNSIGNED} signature/osx
${WRAP_DIR}/genisoimage -no-cache-inodes -D -l -probe -V "MERGE-Qt" -no-pad -r -dir-mode 0755 -apple -o uncompressed.dmg signed-app
${WRAP_DIR}/genisoimage -no-cache-inodes -D -l -probe -V "Merge-Qt" -no-pad -r -dir-mode 0755 -apple -o uncompressed.dmg signed-app
${WRAP_DIR}/dmg dmg uncompressed.dmg ${OUTDIR}/${SIGNED}
Sample configuration files for:
SystemD: MERGEd.service
Upstart: MERGEd.conf
OpenRC: MERGEd.openrc
MERGEd.openrcconf
CentOS: MERGEd.init
SystemD: merged.service
Upstart: merged.conf
OpenRC: merged.openrc
merged.openrcconf
CentOS: merged.init
have been made available to assist packagers in creating node packages here.
......
......@@ -11,5 +11,5 @@ This script should not be run manually, instead, after building as usual:
During the process, the disk image window will pop up briefly where the fancy
settings are applied. This is normal, please do not interfere.
When finished, it will produce `MERGE-Qt.dmg`.
When finished, it will produce `Merge-Qt.dmg`.
......@@ -5,7 +5,7 @@ UNSIGNED=$1
SIGNATURE=$2
ARCH=x86_64
ROOTDIR=dist
BUNDLE=${ROOTDIR}/MERGE-Qt.app
BUNDLE=${ROOTDIR}/Merge-Qt.app
TEMPDIR=signed.temp
OUTDIR=signed-app
......
......@@ -2,7 +2,7 @@
set -e
ROOTDIR=dist
BUNDLE=${ROOTDIR}/MERGE-Qt.app
BUNDLE=${ROOTDIR}/Merge-Qt.app
CODESIGN=codesign
TEMPDIR=sign.temp
TEMPLIST=${TEMPDIR}/signatures.txt
......
......@@ -22,7 +22,7 @@
<integer>370</integer>
<integer>156</integer>
</array>
<key>MERGE-Qt.app</key>
<key>Merge-Qt.app</key>
<array>
<integer>128</integer>
<integer>156</integer>
......
......@@ -2,4 +2,4 @@
This is a Linux bash script that will set up tc to limit the outgoing bandwidth for connections to the Bitcoin network. It limits outbound TCP traffic with a source or destination port of 51472, but not if the destination IP is within a LAN (defined as 192.168.x.x).
This means one can have an always-on MERGEd instance running, and another local MERGEd/MERGE-qt instance which connects to this node and receives blocks from it.
This means one can have an always-on merged instance running, and another local merged/merge-qt instance which connects to this node and receives blocks from it.
......@@ -8,7 +8,7 @@ and remove old versions as necessary.
The seeds compiled into the release are created from fuzzbawls' DNS seed data, like this:
curl -s http://seeder.fuzzbawls.pw/MERGE-mainnet.txt > seeds_main.txt
curl -s http://seeder.projectmerge.org/merge-mainnet.txt > seeds_main.txt
python3 makeseeds.py < seeds_main.txt > nodes_main.txt
python3 generate-seeds.py . > ../../src/chainparamsseeds.h
......
......@@ -7,7 +7,7 @@
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a MERGEd or MERGE-Qt running
# Assumes it will talk to a merged or Merge-Qt running
# on localhost.
#
# Depends on jsonrpc
......@@ -33,7 +33,7 @@ def check_json_precision():
raise RuntimeError("JSON encode/decode loses precision")
def determine_db_dir():
"""Return the default location of the MERGE data directory"""
"""Return the default location of The Merge data directory"""
if platform.system() == "Darwin":
return os.path.expanduser("~/Library/Application Support/PIVX/")
elif platform.system() == "Windows":
......@@ -41,7 +41,7 @@ def determine_db_dir():
return os.path.expanduser("~/.MERGE")
def read_bitcoin_config(dbdir):
"""Read the MERGE.conf file from dbdir, returns dictionary of settings"""
"""Read The Merge.conf file from dbdir, returns dictionary of settings"""
from ConfigParser import SafeConfigParser
class FakeSecHead(object):
......@@ -63,7 +63,7 @@ def read_bitcoin_config(dbdir):
return dict(config_parser.items("all"))
def connect_JSON(config):
"""Connect to a MERGE JSON-RPC server"""
"""Connect to a Merge JSON-RPC server"""
testnet = config.get('testnet', '0')
testnet = (int(testnet) > 0) # 0/1 in config file, convert to True/False
if not 'rpcport' in config:
......@@ -72,7 +72,7 @@ def connect_JSON(config):
try:
result = ServiceProxy(connect)
# ServiceProxy is lazy-connect, so send an RPC command mostly to catch connection errors,
# but also make sure the MERGEd we're talking to is/isn't testnet:
# but also make sure the merged we're talking to is/isn't testnet:
if result.getmininginfo()['testnet'] != testnet:
sys.stderr.write("RPC server at "+connect+" testnet setting mismatch\n")
sys.exit(1)
......@@ -81,32 +81,32 @@ def connect_JSON(config):
sys.stderr.write("Error connecting to RPC server at "+connect+"\n")
sys.exit(1)
def unlock_wallet(MERGEd):
info = MERGEd.getinfo()
def unlock_wallet(merged):
info = merged.getinfo()
if 'unlocked_until' not in info:
return True # wallet is not encrypted
t = int(info['unlocked_until'])
if t <= time.time():
try:
passphrase = getpass.getpass("Wallet is locked; enter passphrase: ")
MERGEd.walletpassphrase(passphrase, 5)
merged.walletpassphrase(passphrase, 5)
except:
sys.stderr.write("Wrong passphrase\n")
info = MERGEd.getinfo()
info = merged.getinfo()
return int(info['unlocked_until']) > time.time()
def list_available(MERGEd):
def list_available(merged):
address_summary = dict()
address_to_account = dict()
for info in MERGEd.listreceivedbyaddress(0):
for info in merged.listreceivedbyaddress(0):
address_to_account[info["address"]] = info["account"]
unspent = MERGEd.listunspent(0)
unspent = merged.listunspent(0)
for output in unspent:
# listunspent doesn't give addresses, so:
rawtx = MERGEd.getrawtransaction(output['txid'], 1)
rawtx = merged.getrawtransaction(output['txid'], 1)
vout = rawtx["vout"][output['vout']]
pk = vout["scriptPubKey"]
......@@ -139,8 +139,8 @@ def select_coins(needed, inputs):
n += 1
return (outputs, have-needed)
def create_tx(MERGEd, fromaddresses, toaddress, amount, fee):
all_coins = list_available(MERGEd)
def create_tx(merged, fromaddresses, toaddress, amount, fee):
all_coins = list_available(merged)
total_available = Decimal("0.0")
needed = amount+fee
......@@ -159,7 +159,7 @@ def create_tx(MERGEd, fromaddresses, toaddress, amount, fee):
# Note:
# Python's json/jsonrpc modules have inconsistent support for Decimal numbers.
# Instead of wrestling with getting json.dumps() (used by jsonrpc) to encode
# Decimals, I'm casting amounts to float before sending them to MERGEd.
# Decimals, I'm casting amounts to float before sending them to merged.
#
outputs = { toaddress : float(amount) }
(inputs, change_amount) = select_coins(needed, potential_inputs)
......@@ -170,8 +170,8 @@ def create_tx(MERGEd, fromaddresses, toaddress, amount, fee):
else:
outputs[change_address] = float(change_amount)
rawtx = MERGEd.createrawtransaction(inputs, outputs)
signed_rawtx = MERGEd.signrawtransaction(rawtx)
rawtx = merged.createrawtransaction(inputs, outputs)
signed_rawtx = merged.signrawtransaction(rawtx)
if not signed_rawtx["complete"]:
sys.stderr.write("signrawtransaction failed\n")
sys.exit(1)
......@@ -179,10 +179,10 @@ def create_tx(MERGEd, fromaddresses, toaddress, amount, fee):
return txdata
def compute_amount_in(MERGEd, txinfo):
def compute_amount_in(merged, txinfo):
result = Decimal("0.0")
for vin in txinfo['vin']:
in_info = MERGEd.getrawtransaction(vin['txid'], 1)
in_info = merged.getrawtransaction(vin['txid'], 1)
vout = in_info['vout'][vin['vout']]
result = result + vout['value']
return result
......@@ -193,12 +193,12 @@ def compute_amount_out(txinfo):
result = result + vout['value']
return result
def sanity_test_fee(MERGEd, txdata_hex, max_fee):
def sanity_test_fee(merged, txdata_hex, max_fee):
class FeeError(RuntimeError):
pass
try:
txinfo = MERGEd.decoderawtransaction(txdata_hex)
total_in = compute_amount_in(MERGEd, txinfo)
txinfo = merged.decoderawtransaction(txdata_hex)
total_in = compute_amount_in(merged, txinfo)
total_out = compute_amount_out(txinfo)
if total_in-total_out > max_fee:
raise FeeError("Rejecting transaction, unreasonable fee of "+str(total_in-total_out))
......@@ -240,10 +240,10 @@ def main():
check_json_precision()
config = read_bitcoin_config(options.datadir)
if options.testnet: config['testnet'] = True
MERGEd = connect_JSON(config)
merged = connect_JSON(config)
if options.amount is None:
address_summary = list_available(MERGEd)
address_summary = list_available(merged)
for address,info in address_summary.iteritems():
n_transactions = len(info['outputs'])
if n_transactions > 1:
......@@ -253,14 +253,14 @@ def main():
else:
fee = Decimal(options.fee)
amount = Decimal(options.amount)
while unlock_wallet(MERGEd) == False:
while unlock_wallet(merged) == False:
pass # Keep asking for passphrase until they get it right
txdata = create_tx(MERGEd, options.fromaddresses.split(","), options.to, amount, fee)
sanity_test_fee(MERGEd, txdata, amount*Decimal("0.01"))
txdata = create_tx(merged, options.fromaddresses.split(","), options.to, amount, fee)
sanity_test_fee(merged, txdata, amount*Decimal("0.01"))
if options.dry_run:
print(txdata)
else:
txid = MERGEd.sendrawtransaction(txdata)
txid = merged.sendrawtransaction(txdata)
print(txid)
if __name__ == '__main__':
......
......@@ -28,7 +28,7 @@ DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
PROJECT_NAME = MERGE
PROJECT_NAME = Merge
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
......