Skip to content

Commit

Permalink
Fixing minor bugs in utxotype and decodescript
Browse files Browse the repository at this point in the history
  • Loading branch information
bpfaff committed Sep 6, 2018
1 parent df94f4b commit 78dd9fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rbtc
Title: Bitcoin API
Version: 0.1-4
Version: 0.1-5
Authors@R: person("Bernhard", "Pfaff", email = "[email protected]", role = c("aut", "cre"))
Description: Implementation of the RPC-JSON API for Bitcoin and utility functions for address creation and content analysis of the blockchain.
Depends: R (>= 3.4.0)
Expand Down
10 changes: 8 additions & 2 deletions R/BlockchainRpcs.R
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,14 @@ verifytxoutproof <- function(con, proof){
#' @aliases decodescript
#' @rdname decodescript
#' @export
decodescript <- function(con, redeem){
decodescript <- function (con, redeem){
rs <- as.character(redeem)
pl <- list(redeem = rs)
if (length(rs) > 1){
msg <- paste0("\nLength of 'redeem' greater than one,\n",
"using first element, only.\n")
warning(msg)
rs <- rs[1]
}
pl <- list(rs)
rpcpost(con, "decodescript", pl)
}
4 changes: 3 additions & 1 deletion R/UtilFuncs.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ utxotype <- function(con, txid){
"result")
vout <- txdec[["vout"]]
ans <- unlist(
lapply(vout, function(x) x[["type"]])
lapply(vout, function(x){
x[["scriptPubKey"]][["type"]]
})
)
ans
}
Expand Down

0 comments on commit 78dd9fb

Please sign in to comment.