Skip to content

Commit

Permalink
Merge pull request #855 from Qitmeer/release/1.2.1
Browse files Browse the repository at this point in the history
Complete the missing commits of dev/1.2 from `release/1.2.1`
  • Loading branch information
dindinw authored Dec 18, 2024
2 parents b76969b + 156a6f5 commit c84c3f8
Show file tree
Hide file tree
Showing 12 changed files with 294 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ qng-build:
@echo "Enable DEBUG"
@go build -o $(GOBIN)/qng$(OUTPUT_SUFFIX) $(GOFLAGS_DEV) -gcflags="all=-N -l" "github.com/Qitmeer/qng/cmd/qng"
else
@go build -o $(GOBIN)/qng$(OUTPUT_SUFFIX) $(GOFLAGS_DEV) "github.com/Qitmeer/qng/cmd/qng"
@go build -o $(GOBIN)/qng$(OUTPUT_SUFFIX) $(GOFLAGS_RELEASE) "github.com/Qitmeer/qng/cmd/qng"
endif
qx:
@go build -o $(GOBIN)/qx $(GOFLAGS_DEV) "github.com/Qitmeer/qng/cmd/qx"
Expand Down
2 changes: 1 addition & 1 deletion consensus/model/acct.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import (

type Acct interface {
Apply(add bool, op *types.TxOutPoint, entry interface{}) error
Commit() error
Commit(point Block) error
}
2 changes: 1 addition & 1 deletion core/blockchain/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func (b *BlockChain) maybeAcceptBlock(block *types.SerializedBlock, flags Behavi
Source: source,
})
if b.Acct != nil {
err = b.Acct.Commit()
err = b.Acct.Commit(ib)
if err != nil {
log.Error(err.Error())
}
Expand Down
11 changes: 6 additions & 5 deletions core/json/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@ type SubsidyInfo struct {
}

type AcctInfo struct {
Mode bool `json:"mode"`
Version uint32 `json:"version"`
Total uint32 `json:"total"`
Watcher uint32 `json:"watcher"`
Addrs []string `json:"addrs,omitempty"`
Mode bool `json:"mode"`
Version uint32 `json:"version"`
StatPoint string `json:"statpoint"`
StatOrder uint32 `json:"statorder"`
Total uint32 `json:"total"`
Addrs []string `json:"addrs,omitempty"`
}

type MeerDAGInfoResult struct {
Expand Down
61 changes: 59 additions & 2 deletions script/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -516,15 +516,45 @@ function get_balance() {
function get_balance_info() {
local address=$1
local coinID=$2
local verbose=$3
if [ "$coinID" == "" ]; then
coinID=0
fi
if [ "$verbose" == "" ]; then
verbose="false"
fi

local data='{"jsonrpc":"2.0","method":"getBalanceInfo","params":["'$address'",'$coinID'],"id":null}'
local data='{"jsonrpc":"2.0","method":"getBalanceInfo","params":["'$address'",'$coinID','$verbose'],"id":null}'
get_result "$data"
}

function get_utxos() {
local address=$1
local limit=$2
local locked=$3
if [ "$limit" == "" ]; then
limit=0
fi
if [ "$locked" == "" ]; then
local data='{"jsonrpc":"2.0","method":"getUTXOs","params":["'$address'",'$limit'],"id":null}'
get_result "$data"
else
local data='{"jsonrpc":"2.0","method":"getUTXOs","params":["'$address'",'$limit','$locked'],"id":null}'
get_result "$data"
fi
}

function get_valid_utxos() {
local address=$1
local amount=$2
if [ "$amount" == "" ]; then
amount=0
fi
if [ "$locked" == "" ]; then
local data='{"jsonrpc":"2.0","method":"getValidUTXOs","params":["'$address'",'$amount'],"id":null}'
get_result "$data"
fi
}

function unlock() {
local account=$1
Expand Down Expand Up @@ -568,11 +598,22 @@ function add_balance() {
get_result "$data"
}

function del_balance() {
local address=$1
local data='{"jsonrpc":"2.0","method":"delBalance","params":["'$address'"],"id":null}'
get_result "$data"
}

function get_acctinfo() {
local data='{"jsonrpc":"2.0","method":"getAcctInfo","params":[],"id":null}'
get_result "$data"
}

function get_acctdebuginfo() {
local data='{"jsonrpc":"2.0","method":"getAcctDebugInfo","params":[],"id":null}'
get_result "$data"
}

function get_network_info(){
local data='{"jsonrpc":"2.0","method":"getNetworkInfo","params":[],"id":null}'
get_result "$data"
Expand Down Expand Up @@ -856,9 +897,11 @@ function usage(){
echo " amanainfo"
echo " amanapeerinfo"
echo " acctinfo"
echo " acctdebuginfo"
echo " getbalance <address> <coinID>"
echo " getbalanceinfo <address> <coinID>"
echo " getbalanceinfo <address> <coinID> <verbose,default=false>"
echo " addbalance <address>"
echo " delbalance <address>"
echo " getaddresses <private key>"
echo " modules"
echo " daginfo"
Expand Down Expand Up @@ -901,6 +944,8 @@ function usage(){
echo " getrawtxs <address>"
echo "utxo :"
echo " getutxo <tx_id> <index> <include_mempool,default=true>"
echo " getutxos <address> <limit> <locked,default=nil is all>"
echo " getvalidutxos <address> <amount>"
echo "miner :"
echo " template"
echo " miningstats"
Expand Down Expand Up @@ -1288,16 +1333,28 @@ elif [ "$1" == "rpcinfo" ]; then
elif [ "$1" == "acctinfo" ]; then
shift
get_acctinfo $@
elif [ "$1" == "acctdebuginfo" ]; then
shift
get_acctdebuginfo $@
elif [ "$1" == "getbalance" ]; then
shift
get_balance $@

elif [ "$1" == "getbalanceinfo" ]; then
shift
get_balance_info $@
elif [ "$1" == "getutxos" ]; then
shift
get_utxos $@
elif [ "$1" == "getvalidutxos" ]; then
shift
get_valid_utxos $@
elif [ "$1" == "addbalance" ]; then
shift
add_balance $@
elif [ "$1" == "delbalance" ]; then
shift
del_balance $@
elif [ "$1" == "rpcmax" ]; then
shift
set_rpc_maxclients $@
Expand Down
Loading

0 comments on commit c84c3f8

Please sign in to comment.