Skip to content

Commit

Permalink
Merge remote-tracking branch 'fork/master' into patch-5
Browse files Browse the repository at this point in the history
 Conflicts:
	contrib/gitian-descriptors/gitian-arm.yml
	contrib/gitian-descriptors/gitian-linux.yml
	contrib/gitian-descriptors/gitian-osx.yml
	contrib/gitian-descriptors/gitian-win.yml
  • Loading branch information
mxaddict committed May 14, 2019
2 parents 5bb0381 + f31382f commit d714e13
Show file tree
Hide file tree
Showing 20 changed files with 202 additions and 75 deletions.
2 changes: 1 addition & 1 deletion contrib/gitian-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ osx=true
SIGNER=
VERSION=
commit=false
url=https://github.com/navcoindev/navcoin-core
url=https://github.com/navcoin/navcoin-core
proc=2
mem=2000
lxc=true
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ packages:
- "ca-certificates"
- "python3"
remotes:
- "url": "https://github.com/NAVCoin/navcoin-core.git"
- "url": "https://github.com/navcoin/navcoin-core.git"
"dir": "navcoin-core"
files: []
script: |
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ packages:
- "python3-setuptools"
- "fonts-tuffy"
remotes:
- "url": "https://github.com/NAVCoin/navcoin-core.git"
- "url": "https://github.com/navcoin/navcoin-core.git"
"dir": "navcoin-core"
files:
- "MacOSX10.11.sdk.tar.gz"
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ packages:
- "python3"
- "rename"
remotes:
- "url": "https://github.com/NAVCoin/navcoin-core.git"
- "url": "https://github.com/navcoin/navcoin-core.git"
"dir": "navcoin-core"
files: []
script: |
Expand Down
6 changes: 5 additions & 1 deletion doc/build-unix.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ Some notes on how to build NavCoin Core in Unix.

## Building in Ubuntu 18.04

You can easily build the dependencies by running the [NavCoin dev tools script here](https://github.com/NAVCoin/navcoin-dev-tools/blob/master/ubuntu-18.04-navcoin-core-dev-setup.sh).
You can easily build the dependencies by running the [NavCoin dev tools script](https://github.com/NAVCoin/navcoin-dev-tools/blob/master/ubuntu-18.04-navcoin-core-dev-setup.sh) using the command bellow.

```bash
curl -o- https://raw.githubusercontent.com/NAVCoin/navcoin-dev-tools/master/ubuntu-18.04-navcoin-core-dev-setup.sh | bash
```

From the navcoin-core directory, you will still need to:
```bash
Expand Down
4 changes: 2 additions & 2 deletions doc/gitian-building.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ Output from `gbuild` will look something like
remote: Total 57959 (delta 0), reused 0 (delta 0), pack-reused 57958
Receiving objects: 100% (57959/57959), 53.76 MiB | 484.00 KiB/s, done.
Resolving deltas: 100% (41590/41590), done.
From https://github.com/navcoindev/navcoin-core
From https://github.com/navcoin/navcoin-core
... (new tags, new branch etc)
--- Building for trusty amd64 ---
Stopping target if it is up
Expand All @@ -390,7 +390,7 @@ and inputs.

For example:
```bash
URL=https://github.com/navcoindev/navcoin-core.git
URL=https://github.com/navcoin/navcoin-core.git
COMMIT=2014_03_windows_unicode_path
./bin/gbuild --commit navcoin-core=${COMMIT} --url navcoin-core=${URL} ../navcoin-core/contrib/gitian-descriptors/gitian-arm.yml
./bin/gbuild --commit navcoin-core=${COMMIT} --url navcoin-core=${URL} ../navcoin-core/contrib/gitian-descriptors/gitian-linux.yml
Expand Down
1 change: 1 addition & 0 deletions qa/pull-tester/rpc-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
'reject-version-bit.py',
'getcoldstakingaddress.py',
'getstakereport.py',
'getstakinginfo.py',
'coldstaking_staking.py',
'coldstaking_spending.py',
'staticr-staking-amount.py',
Expand Down
78 changes: 78 additions & 0 deletions qa/rpc-tests/getstakinginfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env python3
# Copyright (c) 2018 The Navcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from test_framework.test_framework import NavCoinTestFramework
from test_framework.staticr_util import *

#import time

class GetStakingInfo(NavCoinTestFramework):
"""Tests getstakereport accounting."""

def __init__(self):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 1

def setup_network(self, split=False):
self.nodes = self.setup_nodes()
self.is_network_split = False

def run_test(self):
# Turn off staking
self.nodes[0].staking(False)

# Check if we get the error for nWeight
assert(not self.nodes[0].getstakinginfo()['enabled'])
assert(not self.nodes[0].getstakinginfo()['staking'])
assert_equal("Warning: We don't appear to have mature coins.", self.nodes[0].getstakinginfo()['errors'])

# Make it to the static rewards fork!
activate_staticr(self.nodes[0])

# Check balance
assert_equal(59814950, self.nodes[0].getwalletinfo()['balance'] + self.nodes[0].getwalletinfo()['immature_balance'])

# Turn on staking
self.nodes[0].staking(True)

# Check for staking after we have matured coins
assert(self.nodes[0].getstakinginfo()['enabled'])
assert(not self.nodes[0].getstakinginfo()['staking'])
assert_equal("", self.nodes[0].getstakinginfo()['errors'])

# Get the current block count to check against while we wait for a stake
blockcount = self.nodes[0].getblockcount()

# wait for a new block to be mined
while self.nodes[0].getblockcount() == blockcount:
print("waiting for a new block...")
time.sleep(1)

# We got one
print("found a new block...")

# Check balance
assert_equal(59814952, self.nodes[0].getwalletinfo()['balance'] + self.nodes[0].getwalletinfo()['immature_balance'])

# Check if we get the error for nWeight again after a stake
assert(self.nodes[0].getstakinginfo()['enabled'])
assert(self.nodes[0].getstakinginfo()['staking'])
assert_equal("", self.nodes[0].getstakinginfo()['errors'])

# LOCK the wallet
self.nodes[0].encryptwallet("password")
stop_nodes(self.nodes)
wait_navcoinds()
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)

# Check if we get the error for nWeight again after a stake
assert(self.nodes[0].getstakinginfo()['enabled'])
assert(not self.nodes[0].getstakinginfo()['staking'])
assert_equal("Warning: Wallet is locked. Please enter the wallet passphrase with walletpassphrase first.", self.nodes[0].getstakinginfo()['errors'])


if __name__ == '__main__':
GetStakingInfo().main()
6 changes: 3 additions & 3 deletions src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

//! These need to be macros, as clientversion.cpp's and navcoin*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 4
#define CLIENT_VERSION_MINOR 5
#define CLIENT_VERSION_REVISION 2
#define CLIENT_VERSION_MINOR 6
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0

//! Set to true for release, false for prerelease or test build
Expand All @@ -32,7 +32,7 @@
* Copyright year (2009-this)
* Todo: update this when changing our copyright comments in the source
*/
#define COPYRIGHT_YEAR 2018
#define COPYRIGHT_YEAR 2019

#endif //HAVE_CONFIG_H

Expand Down
36 changes: 29 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2542,7 +2542,7 @@ bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockI
} else if (prevout.scriptPubKey.IsPayToPublicKey() || prevout.scriptPubKey.IsColdStaking()) {
uint160 hashBytes;
int type = 0;
CTxDestination destination;
CTxDestination destination;
ExtractDestination(prevout.scriptPubKey, destination);
CNavCoinAddress address(destination);
if (prevout.scriptPubKey.IsColdStaking())
Expand Down Expand Up @@ -6260,6 +6260,11 @@ void static CheckBlockIndex(const Consensus::Params& consensusParams)
}

std::string GetWarnings(const std::string& strFor)
{
return GetWarnings(strFor, false);
}

std::string GetWarnings(const std::string& strFor, bool fForStaking)
{
string strStatusBar;
string strRPC;
Expand All @@ -6275,7 +6280,6 @@ std::string GetWarnings(const std::string& strFor)
strStatusBar = "This is a Release Candidate build - use at your own risk - please make sure your wallet is backed up";
strGUI = _("This is a Release Candidate build - use at your own risk - please make sure your wallet is backed up");
}

}

if (GetBoolArg("-testsafemode", DEFAULT_TESTSAFEMODE))
Expand All @@ -6290,20 +6294,38 @@ std::string GetWarnings(const std::string& strFor)
if (fLargeWorkForkFound)
{
strStatusBar = strRPC = "Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.";
strGUI = _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.");
strGUI = _(strRPC.c_str());
}
else if (fLargeWorkInvalidChainFound)
{
strStatusBar = strRPC = "Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade.";
strGUI = _("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade.");
strGUI = _(strRPC.c_str());
}

if (fForStaking)
{
if (pwalletMain->IsLocked())
{
strStatusBar = strRPC = "Warning: Wallet is locked. Please enter the wallet passphrase with walletpassphrase first.";
strGUI = _(strRPC.c_str());
}

if (!pwalletMain->GetStakeWeight())
{
strStatusBar = strRPC = "Warning: We don't appear to have mature coins.";
strGUI = _(strRPC.c_str());
}
}

if (strFor == "gui")
return strGUI;
else if (strFor == "statusbar")

if (strFor == "statusbar")
return strStatusBar;
else if (strFor == "rpc")

if (strFor == "rpc")
return strRPC;

assert(!"GetWarnings(): invalid parameter");
return "error";
}
Expand Down Expand Up @@ -7120,7 +7142,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
CTransaction tx;
vRecv >> tx;

LogPrint("net", "Received tx %s peer=%d\n%s\n", tx.GetHash().ToString(), pfrom->id, tx.ToString());
LogPrint("net", "Received tx %s peer=%d\n%s\n", tx.GetHash().ToString(), pfrom->id, tx.ToString());

CInv inv(MSG_TX, tx.GetHash());
pfrom->AddInventoryKnown(inv);
Expand Down
1 change: 1 addition & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ bool IsInitialBlockDownload();
* This function only returns the highest priority warning of the set selected by strFor.
*/
std::string GetWarnings(const std::string& strFor);
std::string GetWarnings(const std::string& strFor, bool fForStaking);
/** Retrieve a transaction (from memory pool, or from disk, if possible) */
bool GetTransaction(const uint256 &hash, CTransaction &tx, const Consensus::Params& params, uint256 &hashBlock, bool fAllowSlow = false);
/** Find the best known block, and make it the tip of the block chain */
Expand Down
44 changes: 19 additions & 25 deletions src/qt/communityfundcreatepaymentrequestdialog.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#include "communityfundcreatepaymentrequestdialog.h"
#include "ui_communityfundcreatepaymentrequestdialog.h"
#include "communityfundsuccessdialog.h"
#include "sendcommunityfunddialog.h"
#include "ui_communityfundcreatepaymentrequestdialog.h"

#include <QMessageBox>
#include <string>

#include "base58.h"
#include "consensus/cfund.h"
#include "main.h"
#include "main.cpp"
#include "guiconstants.h"
#include "skinize.h"
#include "guiutil.h"
#include "main.cpp"
#include "main.h"
#include "skinize.h"
#include "sync.h"
#include "wallet/wallet.h"
#include "base58.h"
#include <string>
#include "walletmodel.h"

std::string random_str(size_t length)
{
Expand All @@ -33,14 +35,20 @@ std::string random_str(size_t length)

CommunityFundCreatePaymentRequestDialog::CommunityFundCreatePaymentRequestDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::CommunityFundCreatePaymentRequestDialog)
ui(new Ui::CommunityFundCreatePaymentRequestDialog),
model(0)
{
ui->setupUi(this);

connect(ui->pushButtonClose, SIGNAL(clicked()), this, SLOT(reject()));
connect(ui->pushButtonSubmitPaymentRequest, SIGNAL(clicked()), SLOT(click_pushButtonSubmitPaymentRequest()));
}

void CommunityFundCreatePaymentRequestDialog::setModel(WalletModel *model)
{
this->model = model;
}

bool CommunityFundCreatePaymentRequestDialog::validate()
{
bool isValid = true;
Expand Down Expand Up @@ -131,24 +139,10 @@ void CommunityFundCreatePaymentRequestDialog::click_pushButtonSubmitPaymentReque
}

// Ensure wallet is unlocked
if (pwalletMain->IsLocked()) {
QMessageBox msgBox(this);
std::string str = "Please unlock the wallet\n";
msgBox.setText(tr(str.c_str()));
msgBox.addButton(tr("Ok"), QMessageBox::AcceptRole);
msgBox.setIcon(QMessageBox::Warning);
msgBox.setWindowTitle("Error");
msgBox.exec();
return;
}
if (fWalletUnlockStakingOnly) {
QMessageBox msgBox(this);
std::string str = "Wallet is unlocked for staking only\n";
msgBox.setText(tr(str.c_str()));
msgBox.addButton(tr("Ok"), QMessageBox::AcceptRole);
msgBox.setIcon(QMessageBox::Warning);
msgBox.setWindowTitle("Error");
msgBox.exec();
WalletModel::UnlockContext ctx(model->requestUnlock());
if(!ctx.isValid())
{
// Unlock wallet was cancelled
return;
}

Expand Down
7 changes: 6 additions & 1 deletion src/qt/communityfundcreatepaymentrequestdialog.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#ifndef COMMUNITYFUNDCREATEPAYMENTREQUESTDIALOG_H
#define COMMUNITYFUNDCREATEPAYMENTREQUESTDIALOG_H

#include <QDialog>
#include "../qvalidatedplaintextedit.h"
#include "uint256.h"
#include "walletmodel.h"

#include <QDialog>

namespace Ui {
class CommunityFundCreatePaymentRequestDialog;
Expand All @@ -17,8 +19,11 @@ class CommunityFundCreatePaymentRequestDialog : public QDialog
explicit CommunityFundCreatePaymentRequestDialog(QWidget *parent = 0);
~CommunityFundCreatePaymentRequestDialog();

void setModel(WalletModel *model);

private:
Ui::CommunityFundCreatePaymentRequestDialog *ui;
WalletModel *model;
bool validate();
bool isActiveProposal(uint256 hash);

Expand Down
Loading

0 comments on commit d714e13

Please sign in to comment.