2020-01-30 22:46:08 +00:00
|
|
|
// VulcanizeDB
|
|
|
|
// Copyright © 2019 Vulcanize
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
package btc
|
|
|
|
|
2020-02-04 21:20:49 +00:00
|
|
|
import "github.com/lib/pq"
|
|
|
|
|
2020-01-31 20:08:51 +00:00
|
|
|
// HeaderModel is the db model for btc.header_cids table
|
2020-01-30 22:46:08 +00:00
|
|
|
type HeaderModel struct {
|
|
|
|
ID int64 `db:"id"`
|
|
|
|
BlockNumber string `db:"block_number"`
|
|
|
|
BlockHash string `db:"block_hash"`
|
|
|
|
ParentHash string `db:"parent_hash"`
|
|
|
|
CID string `db:"cid"`
|
2020-01-31 20:08:51 +00:00
|
|
|
Timestamp int64 `db:"timestamp"`
|
2020-02-02 21:58:07 +00:00
|
|
|
Bits uint32 `db:"bits"`
|
2020-02-10 15:00:55 +00:00
|
|
|
NodeID int64 `db:"node_id"`
|
2020-01-30 22:46:08 +00:00
|
|
|
}
|
|
|
|
|
2020-01-31 20:08:51 +00:00
|
|
|
// TxModel is the db model for btc.transaction_cids table
|
2020-01-30 22:46:08 +00:00
|
|
|
type TxModel struct {
|
|
|
|
ID int64 `db:"id"`
|
|
|
|
HeaderID int64 `db:"header_id"`
|
|
|
|
Index int64 `db:"index"`
|
|
|
|
TxHash string `db:"tx_hash"`
|
|
|
|
CID string `db:"cid"`
|
2020-02-04 21:20:49 +00:00
|
|
|
SegWit bool `db:"segwit"`
|
2020-01-30 22:46:08 +00:00
|
|
|
WitnessHash string `db:"witness_hash"`
|
2020-01-31 20:08:51 +00:00
|
|
|
}
|
|
|
|
|
2020-02-02 21:58:07 +00:00
|
|
|
// TxModelWithInsAndOuts is the db model for btc.transaction_cids table that includes the children tx_input and tx_output tables
|
|
|
|
type TxModelWithInsAndOuts struct {
|
|
|
|
ID int64 `db:"id"`
|
|
|
|
HeaderID int64 `db:"header_id"`
|
|
|
|
Index int64 `db:"index"`
|
|
|
|
TxHash string `db:"tx_hash"`
|
|
|
|
CID string `db:"cid"`
|
2020-02-04 21:20:49 +00:00
|
|
|
SegWit bool `db:"segwit"`
|
2020-02-02 21:58:07 +00:00
|
|
|
WitnessHash string `db:"witness_hash"`
|
|
|
|
TxInputs []TxInput
|
|
|
|
TxOutputs []TxOutput
|
|
|
|
}
|
|
|
|
|
2020-01-31 20:08:51 +00:00
|
|
|
// TxInput is the db model for btc.tx_inputs table
|
|
|
|
type TxInput struct {
|
|
|
|
ID int64 `db:"id"`
|
|
|
|
TxID int64 `db:"tx_id"`
|
|
|
|
Index int64 `db:"index"`
|
2020-02-04 21:20:49 +00:00
|
|
|
TxWitness [][]byte `db:"witness"`
|
2020-02-02 21:58:07 +00:00
|
|
|
SignatureScript []byte `db:"sig_script"`
|
2020-02-09 21:58:37 +00:00
|
|
|
PreviousOutPointID int64 `db:"outpoint_id"`
|
|
|
|
PreviousOutPointIndex uint32
|
|
|
|
PreviousOutPointHash string
|
2020-01-31 20:08:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TxOutput is the db model for btc.tx_outputs table
|
|
|
|
type TxOutput struct {
|
2020-02-04 21:20:49 +00:00
|
|
|
ID int64 `db:"id"`
|
|
|
|
TxID int64 `db:"tx_id"`
|
|
|
|
Index int64 `db:"index"`
|
|
|
|
Value int64 `db:"value"`
|
|
|
|
PkScript []byte `db:"pk_script"`
|
|
|
|
ScriptClass uint8 `db:"script_class"`
|
|
|
|
RequiredSigs int64 `db:"required_sigs"`
|
|
|
|
Addresses pq.StringArray `db:"addresses"`
|
2020-01-30 22:46:08 +00:00
|
|
|
}
|