Example #1
0
func (a *Address) CustomMarshalText() (text []byte, err error) {
	var out primitives.Buffer
	addr := hex.EncodeToString(a.Bytes())
	out.WriteString("addr  ")
	out.WriteString(addr)
	return out.DeepCopyBytes(), nil
}
Example #2
0
func (e *ECBlockBody) String() string {
	var out primitives.Buffer
	for _, v := range e.Entries {
		out.WriteString(v.String())
	}
	return string(out.DeepCopyBytes())
}
Example #3
0
func (e *EBlockBody) String() string {
	var out primitives.Buffer
	for _, eh := range e.EBEntries {
		out.WriteString(fmt.Sprintf("    %20s: %x\n", "Entry Hash", eh.Bytes()[:3]))
	}
	return (string)(out.DeepCopyBytes())
}
func (e *AddReplaceMatryoshkaHash) String() string {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf("    E: %35s -- %17s %8x %12s %8s\n",
		"AddReplaceMatryoshkaHash",
		"IdentityChainID", e.IdentityChainID.Bytes()[:4],
		"MHash", e.MHash.String()[:8]))
	return (string)(out.DeepCopyBytes())
}
func (e *AddFederatedServerBitcoinAnchorKey) String() string {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf("    E: %35s -- %17s %8x %12s %8x %12s %8x %12s %8s\n",
		"AddFederatedServerBitcoinAnchorKey",
		"IdentityChainID", e.IdentityChainID.Bytes()[:4],
		"KeyPriority", e.KeyPriority,
		"KeyType", e.KeyType,
		"ECDSAPublicKey", e.ECDSAPublicKey.String()[:8]))
	return (string)(out.DeepCopyBytes())
}
func (e *AddFederatedServerSigningKey) String() string {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf("    E: %35s -- %17s %8x %12s %8x %12s %8s %12s %d\n",
		"AddFederatedServerSigningKey",
		"IdentityChainID", e.IdentityChainID.Bytes()[:4],
		"KeyPriority", e.KeyPriority,
		"PublicKey", e.PublicKey.String()[:8],
		"DBHeight", e.DBHeight))
	return (string)(out.DeepCopyBytes())
}
Example #7
0
// Make this into somewhat readable text.
func (ta TransAddress) CustomMarshalTextAll(fct bool, label string) ([]byte, error) {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf("   %8s:", label))
	v := primitives.ConvertDecimalToPaddedString(ta.Amount)
	fill := 8 - len(v) + strings.Index(v, ".") + 1
	fstr := fmt.Sprintf("%%%vs%%%vs ", 18-fill, fill)
	out.WriteString(fmt.Sprintf(fstr, v, ""))
	if fct {
		out.WriteString(primitives.ConvertFctAddressToUserStr(ta.Address))
	} else {
		out.WriteString(primitives.ConvertECAddressToUserStr(ta.Address))
	}
	str := fmt.Sprintf("\n                  %016x %038s\n\n", ta.Amount, string(hex.EncodeToString(ta.GetAddress().Bytes())))
	out.WriteString(str)
	return out.DeepCopyBytes(), nil
}
Example #8
0
func (a RCD_1) CustomMarshalText() (text []byte, err error) {
	var out primitives.Buffer
	out.WriteString("RCD 1: ")
	primitives.WriteNumber8(&out, uint8(1)) // Type Zero Authorization
	out.WriteString(" ")
	out.WriteString(hex.EncodeToString(a.PublicKey[:]))
	out.WriteString("\n")

	return out.DeepCopyBytes(), nil
}
Example #9
0
func (c *AdminBlock) String() string {
	var out primitives.Buffer

	fh, _ := c.BackReferenceHash()
	if fh == nil {
		fh = primitives.NewZeroHash()
	}
	out.WriteString(fmt.Sprintf("%20s %x\n", "Primary Hash:", c.DatabasePrimaryIndex().Bytes()))
	out.WriteString(fmt.Sprintf("%20s %x\n", "512 Sha3:", fh.Bytes()))

	out.WriteString(c.Header.String())
	out.WriteString("Entries: \n")
	for _, entry := range c.ABEntries {
		out.WriteString(entry.String())
	}

	return (string)(out.DeepCopyBytes())
}
Example #10
0
func (s FactoidSignature) CustomMarshalText() ([]byte, error) {
	var out primitives.Buffer

	out.WriteString(" FactoidSignature: ")
	out.WriteString(hex.EncodeToString(s.Signature[:]))
	out.WriteString("\n")

	return out.DeepCopyBytes(), nil
}
Example #11
0
func (e *IncreaseBalance) String() string {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf(" %-20s\n", "IncreaseBalance"))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "ECPubKey", e.ECPubKey[:3]))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "TXID", e.TXID.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("   %-20s %d\n", "Index", e.Index))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "NumEC", e.NumEC))

	return (string)(out.DeepCopyBytes())
}
Example #12
0
func (s SignatureBlock) CustomMarshalText() ([]byte, error) {
	var out primitives.Buffer

	out.WriteString("Signature Block: \n")
	for _, sig := range s.Signatures {

		out.WriteString(" signature: ")
		txt, err := sig.CustomMarshalText()
		if err != nil {
			return nil, err
		}
		out.Write(txt)
		out.WriteString("\n ")

	}

	return out.DeepCopyBytes(), nil
}
Example #13
0
func (a RCD_2) CustomMarshalText() ([]byte, error) {
	var out primitives.Buffer

	primitives.WriteNumber8(&out, uint8(2)) // Type 2 Authorization
	out.WriteString("\n n: ")
	primitives.WriteNumber16(&out, uint16(a.N))
	out.WriteString(" m: ")
	primitives.WriteNumber16(&out, uint16(a.M))
	out.WriteString("\n")
	for i := 0; i < a.M; i++ {
		out.WriteString("  m: ")
		out.WriteString(hex.EncodeToString(a.N_Addresses[i].Bytes()))
		out.WriteString("\n")
	}

	return out.DeepCopyBytes(), nil
}
Example #14
0
func (e *EBlockHeader) String() string {
	var out primitives.Buffer
	out.WriteString("  Entry Block Header\n")
	out.WriteString(fmt.Sprintf("    %20s: %x\n", "ChainID", e.ChainID.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("    %20s: %x\n", "BodyMR", e.BodyMR.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("    %20s: %x\n", "PrevKeyMR", e.PrevKeyMR.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("    %20s: %x\n", "PrevFullHash", e.PrevFullHash.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("    %20s: %10v\n", "EBSequence", e.EBSequence))
	out.WriteString(fmt.Sprintf("    %20s: %10v\n", "DBHeight", e.DBHeight))
	out.WriteString(fmt.Sprintf("    %20s: %x\n", "EntryCount", e.EntryCount))
	return (string)(out.DeepCopyBytes())
}
Example #15
0
func (e *ABlockHeader) String() string {
	var out primitives.Buffer
	out.WriteString("  Admin Block Header\n")
	out.WriteString(fmt.Sprintf("    %20s: %10v\n", "PrevBackRefHash", e.PrevBackRefHash.String()))
	out.WriteString(fmt.Sprintf("    %20s: %10v\n", "DBHeight", e.DBHeight))
	out.WriteString(fmt.Sprintf("    %20s: %10v\n", "HeaderExpansionSize", e.HeaderExpansionSize))
	out.WriteString(fmt.Sprintf("    %20s: %x\n", "HeaderExpansionArea", e.HeaderExpansionArea))
	out.WriteString(fmt.Sprintf("    %20s: %x\n", "MessageCount", e.MessageCount))
	out.WriteString(fmt.Sprintf("    %20s: %x\n", "MessageCount", e.BodySize))
	return (string)(out.DeepCopyBytes())
}
Example #16
0
func (e *MinuteNumber) String() string {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf(" %-20s\n", "MinuteNumber"))
	out.WriteString(fmt.Sprintf("   %-20s %d\n", "Number", e.Number))
	return (string)(out.DeepCopyBytes())
}
Example #17
0
// Marshal to text.  Largely a debugging thing.
func (t *Transaction) CustomMarshalText() (text []byte, err error) {
	data, err := t.MarshalBinary()
	if err != nil {
		return nil, err
	}
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf("Transaction (size %d):\n", len(data)))
	out.WriteString("                 Version: ")
	primitives.WriteNumber64(&out, uint64(t.GetVersion()))
	out.WriteString("\n          MilliTimestamp: ")
	primitives.WriteNumber64(&out, uint64(t.MilliTimestamp))
	ts := time.Unix(0, int64(t.MilliTimestamp*1000000))
	out.WriteString(ts.UTC().Format(" Jan 2, 2006 at 15:04:05 (MST)"))
	out.WriteString("\n                # Inputs: ")
	primitives.WriteNumber16(&out, uint16(len(t.Inputs)))
	out.WriteString("\n               # Outputs: ")
	primitives.WriteNumber16(&out, uint16(len(t.Outputs)))
	out.WriteString("\n   # EntryCredit Outputs: ")
	primitives.WriteNumber16(&out, uint16(len(t.OutECs)))
	out.WriteString("\n")
	for _, address := range t.Inputs {
		text, _ := address.CustomMarshalText()
		out.Write(text)
	}
	for _, address := range t.Outputs {
		text, _ := address.CustomMarshalText()
		out.Write(text)
	}
	for _, ecaddress := range t.OutECs {
		text, _ := ecaddress.CustomMarshalText()
		out.Write(text)
	}
	for i, rcd := range t.RCDs {
		text, err = rcd.CustomMarshalText()
		if err != nil {
			return nil, err
		}
		out.Write(text)

		for len(t.SigBlocks) <= i {
			t.SigBlocks = append(t.SigBlocks, new(SignatureBlock))
		}
		text, err := t.SigBlocks[i].CustomMarshalText()
		if err != nil {
			return nil, err
		}
		out.Write(text)
	}

	return out.DeepCopyBytes(), nil
}
Example #18
0
func (e *CommitChain) String() string {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf(" %-20s\n", "CommitChain"))
	out.WriteString(fmt.Sprintf("   %-20s %d\n", "Version", e.Version))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "MilliTime", e.MilliTime))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "ChainIDHash", e.ChainIDHash.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "Weld", e.Weld.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "EntryHash", e.EntryHash.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "Credits", e.Credits))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "ECPubKey", e.ECPubKey[:3]))
	out.WriteString(fmt.Sprintf("   %-20s %d\n", "Sig", e.Sig[:3]))

	return (string)(out.DeepCopyBytes())
}
Example #19
0
// Marshal to text.  Largely a debugging thing.
func (b FBlock) CustomMarshalText() (text []byte, err error) {
	var out primitives.Buffer

	out.WriteString("Transaction Block\n")
	out.WriteString("  ChainID:       ")
	out.WriteString(hex.EncodeToString(constants.FACTOID_CHAINID))
	keyMR := b.GetKeyMR()
	out.WriteString("\n  KeyMR (NM):    ")
	out.WriteString(keyMR.String())

	if b.BodyMR == nil {
		b.BodyMR = new(primitives.Hash)
	}
	out.WriteString("\n  BodyMR:        ")
	out.WriteString(b.BodyMR.String())
	if b.PrevKeyMR == nil {
		b.PrevKeyMR = new(primitives.Hash)
	}
	out.WriteString("\n  PrevKeyMR:     ")
	out.WriteString(b.PrevKeyMR.String())
	if b.PrevLedgerKeyMR == nil {
		b.PrevLedgerKeyMR = new(primitives.Hash)
	}
	out.WriteString("\n  PrevLedgerKeyMR:  ")
	out.WriteString(b.PrevLedgerKeyMR.String())
	out.WriteString("\n  ExchRate:      ")
	out.WriteString(fmt.Sprintf("%d.%08d fct, %d factoshis", b.ExchRate/100000000, b.ExchRate%100000000, b.ExchRate))
	out.WriteString(fmt.Sprintf("\n  DBHeight:      %v", b.DBHeight))
	out.WriteString("\n  Period Marks:  ")
	for _, mark := range b.endOfPeriod {
		out.WriteString(fmt.Sprintf("%d ", mark))
	}
	out.WriteString("\n  #Transactions: ")
	primitives.WriteNumber32(&out, uint32(len(b.Transactions)))
	transdata, err := b.MarshalTrans()
	if err != nil {
		return nil, err
	}
	out.WriteString("\n  Body Size:     ")
	primitives.WriteNumber32(&out, uint32(len(transdata)))
	out.WriteString("\n\n")
	markPeriod := 0

	for i, trans := range b.Transactions {
		for markPeriod < 10 && i == b.endOfPeriod[markPeriod] {
			out.WriteString(fmt.Sprintf("\n   End of Minute %d\n\n", markPeriod+1))
			markPeriod++
		}

		txt, err := trans.CustomMarshalText()
		if err != nil {
			return nil, err
		}
		out.Write(txt)
	}
	return out.DeepCopyBytes(), nil
}
func (e *DBlockHeader) String() string {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf("  Version:         %v\n", e.Version))
	out.WriteString(fmt.Sprintf("  NetworkID:       %x\n", e.NetworkID))
	out.WriteString(fmt.Sprintf("  BodyMR:          %s\n", e.BodyMR.String()))
	out.WriteString(fmt.Sprintf("  PrevKeyMR:       %s\n", e.PrevKeyMR.String()))
	out.WriteString(fmt.Sprintf("  PrevFullHash:    %s\n", e.PrevFullHash.String()))
	out.WriteString(fmt.Sprintf("  Timestamp:       %d\n", e.Timestamp))
	out.WriteString(fmt.Sprintf("  Timestamp Str:   %s\n", e.GetTimestamp().String()))
	out.WriteString(fmt.Sprintf("  DBHeight:        %d\n", e.DBHeight))
	out.WriteString(fmt.Sprintf("  BlockCount:      %d\n", e.BlockCount))

	return (string)(out.DeepCopyBytes())
}
Example #21
0
func (s *FactomdConfig) String() string {
	var out primitives.Buffer

	out.WriteString(fmt.Sprintf("\nFactomd Config"))
	out.WriteString(fmt.Sprintf("\n  App"))
	out.WriteString(fmt.Sprintf("\n    PortNumber              %v", s.App.PortNumber))
	out.WriteString(fmt.Sprintf("\n    HomeDir                 %v", s.App.HomeDir))
	out.WriteString(fmt.Sprintf("\n    ControlPanelPort        %v", s.App.ControlPanelPort))
	out.WriteString(fmt.Sprintf("\n    ControlPanelFilesPath   %v", s.App.ControlPanelFilesPath))
	out.WriteString(fmt.Sprintf("\n    ControlPanelSetting     %v", s.App.ControlPanelSetting))
	out.WriteString(fmt.Sprintf("\n    DBType                  %v", s.App.DBType))
	out.WriteString(fmt.Sprintf("\n    LdbPath                 %v", s.App.LdbPath))
	out.WriteString(fmt.Sprintf("\n    BoltDBPath              %v", s.App.BoltDBPath))
	out.WriteString(fmt.Sprintf("\n    DataStorePath           %v", s.App.DataStorePath))
	out.WriteString(fmt.Sprintf("\n    DirectoryBlockInSeconds %v", s.App.DirectoryBlockInSeconds))
	out.WriteString(fmt.Sprintf("\n    ExportData              %v", s.App.ExportData))
	out.WriteString(fmt.Sprintf("\n    ExportDataSubpath       %v", s.App.ExportDataSubpath))
	out.WriteString(fmt.Sprintf("\n    Network                 %v", s.App.Network))
	out.WriteString(fmt.Sprintf("\n    MainNetworkPort         %v", s.App.MainNetworkPort))
	out.WriteString(fmt.Sprintf("\n    PeersFile               %v", s.App.PeersFile))
	out.WriteString(fmt.Sprintf("\n    MainSeedURL             %v", s.App.MainSeedURL))
	out.WriteString(fmt.Sprintf("\n    MainSpecialPeers        %v", s.App.MainSpecialPeers))
	out.WriteString(fmt.Sprintf("\n    TestNetworkPort         %v", s.App.TestNetworkPort))
	out.WriteString(fmt.Sprintf("\n    TestSeedURL             %v", s.App.TestSeedURL))
	out.WriteString(fmt.Sprintf("\n    TestSpecialPeers        %v", s.App.TestSpecialPeers))
	out.WriteString(fmt.Sprintf("\n    LocalNetworkPort        %v", s.App.LocalNetworkPort))
	out.WriteString(fmt.Sprintf("\n    LocalSeedURL            %v", s.App.LocalSeedURL))
	out.WriteString(fmt.Sprintf("\n    LocalSpecialPeers       %v", s.App.LocalSpecialPeers))
	out.WriteString(fmt.Sprintf("\n    NodeMode                %v", s.App.NodeMode))
	out.WriteString(fmt.Sprintf("\n    IdentityChainID         %v", s.App.IdentityChainID))
	out.WriteString(fmt.Sprintf("\n    LocalServerPrivKey      %v", s.App.LocalServerPrivKey))
	out.WriteString(fmt.Sprintf("\n    LocalServerPublicKey    %v", s.App.LocalServerPublicKey))
	out.WriteString(fmt.Sprintf("\n    ExchangeRate            %v", s.App.ExchangeRate))
	out.WriteString(fmt.Sprintf("\n    ExchangeRateChainId     %v", s.App.ExchangeRateChainId))
	out.WriteString(fmt.Sprintf("\n    ExchangeRateAuthorityAddress   %v", s.App.ExchangeRateAuthorityAddress))
	out.WriteString(fmt.Sprintf("\n    FactomdTlsEnabled        %v", s.App.FactomdTlsEnabled))
	out.WriteString(fmt.Sprintf("\n    FactomdTlsPrivateKey     %v", s.App.FactomdTlsPrivateKey))
	out.WriteString(fmt.Sprintf("\n    FactomdTlsPublicCert     %v", s.App.FactomdTlsPublicCert))
	out.WriteString(fmt.Sprintf("\n    FactomdRpcUser          %v", s.App.FactomdRpcUser))
	out.WriteString(fmt.Sprintf("\n    FactomdRpcPass          %v", s.App.FactomdRpcPass))

	out.WriteString(fmt.Sprintf("\n  Anchor"))
	out.WriteString(fmt.Sprintf("\n    ServerECPrivKey         %v", s.Anchor.ServerECPrivKey))
	out.WriteString(fmt.Sprintf("\n    ServerECPublicKey       %v", s.Anchor.ServerECPublicKey))
	out.WriteString(fmt.Sprintf("\n    AnchorChainID           %v", s.Anchor.AnchorChainID))
	out.WriteString(fmt.Sprintf("\n    ConfirmationsNeeded     %v", s.Anchor.ConfirmationsNeeded))

	out.WriteString(fmt.Sprintf("\n  Btc"))
	out.WriteString(fmt.Sprintf("\n    BTCPubAddr              %v", s.Btc.BTCPubAddr))
	out.WriteString(fmt.Sprintf("\n    SendToBTCinSeconds      %v", s.Btc.SendToBTCinSeconds))
	out.WriteString(fmt.Sprintf("\n    WalletPassphrase        %v", s.Btc.WalletPassphrase))
	out.WriteString(fmt.Sprintf("\n    CertHomePath            %v", s.Btc.CertHomePath))
	out.WriteString(fmt.Sprintf("\n    RpcClientHost           %v", s.Btc.RpcClientHost))
	out.WriteString(fmt.Sprintf("\n    RpcClientEndpoint       %v", s.Btc.RpcClientEndpoint))
	out.WriteString(fmt.Sprintf("\n    RpcClientUser           %v", s.Btc.RpcClientUser))
	out.WriteString(fmt.Sprintf("\n    RpcClientPass           %v", s.Btc.RpcClientPass))
	out.WriteString(fmt.Sprintf("\n    BtcTransFee             %v", s.Btc.BtcTransFee))
	out.WriteString(fmt.Sprintf("\n    CertHomePathBtcd        %v", s.Btc.CertHomePathBtcd))
	out.WriteString(fmt.Sprintf("\n    RpcBtcdHost             %v", s.Btc.RpcBtcdHost))

	out.WriteString(fmt.Sprintf("\n  Wsapi"))
	out.WriteString(fmt.Sprintf("\n    PortNumber              %v", s.Wsapi.PortNumber))
	out.WriteString(fmt.Sprintf("\n    ApplicationName         %v", s.Wsapi.ApplicationName))

	out.WriteString(fmt.Sprintf("\n  Log"))
	out.WriteString(fmt.Sprintf("\n    LogPath                 %v", s.Log.LogPath))
	out.WriteString(fmt.Sprintf("\n    LogLevel                %v", s.Log.LogLevel))
	out.WriteString(fmt.Sprintf("\n    ConsoleLogLevel         %v", s.Log.ConsoleLogLevel))

	out.WriteString(fmt.Sprintf("\n  Wallet"))
	out.WriteString(fmt.Sprintf("\n    Address                 %v", s.Wallet.Address))
	out.WriteString(fmt.Sprintf("\n    Port                    %v", s.Wallet.Port))
	out.WriteString(fmt.Sprintf("\n    DataFile                %v", s.Wallet.DataFile))
	out.WriteString(fmt.Sprintf("\n    RefreshInSeconds        %v", s.Wallet.RefreshInSeconds))
	out.WriteString(fmt.Sprintf("\n    BoltDBPath              %v", s.Wallet.BoltDBPath))

	out.WriteString(fmt.Sprintf("\n  Walletd"))
	out.WriteString(fmt.Sprintf("\n    WalletRpcUser           %v", s.Walletd.WalletRpcUser))
	out.WriteString(fmt.Sprintf("\n    WalletRpcPass           %v", s.Walletd.WalletRpcPass))
	out.WriteString(fmt.Sprintf("\n    WalletTlsEnabled        %v", s.Walletd.WalletTlsEnabled))
	out.WriteString(fmt.Sprintf("\n    WalletTlsPrivateKey     %v", s.Walletd.WalletTlsPrivateKey))
	out.WriteString(fmt.Sprintf("\n    WalletTlsPublicCert     %v", s.Walletd.WalletTlsPublicCert))
	out.WriteString(fmt.Sprintf("\n    FactomdLocation         %v", s.Walletd.FactomdLocation))
	out.WriteString(fmt.Sprintf("\n    WalletdLocation         %v", s.Walletd.WalletdLocation))

	return out.String()
}
func (e *DBEntry) String() string {
	var out primitives.Buffer
	out.WriteString("ChainID: " + e.GetChainID().String() + "\n")
	out.WriteString("      KeyMR:   " + e.GetKeyMR().String() + "\n")
	return (string)(out.DeepCopyBytes())
}
Example #23
0
func (p *ProcessList) String() string {
	var buf primitives.Buffer
	if p == nil {
		buf.WriteString("-- <nil>\n")
	} else {
		buf.WriteString("===ProcessListStart===\n")
		buf.WriteString(fmt.Sprintf("%s #VMs %d Complete %v DBHeight %d DBSig %v EOM %v\n",
			p.State.GetFactomNodeName(),
			len(p.FedServers),
			p.Complete(),
			p.DBHeight,
			p.State.DBSig,
			p.State.EOM))

		for i := 0; i < len(p.FedServers); i++ {
			vm := p.VMs[i]
			buf.WriteString(fmt.Sprintf("  VM %d  vMin %d vHeight %v len(List)%d Syncing %v Synced %v EOMProcessed %d DBSigProcessed %d NextHt: %d\n",
				i, vm.LeaderMinute, vm.Height, len(vm.List), p.State.Syncing, vm.Synced, p.State.EOMProcessed, p.State.DBSigProcessed, p.NextHeightToProcess[i]))
			for j, msg := range vm.List {
				buf.WriteString(fmt.Sprintf("   %3d", j))
				if j < vm.Height {
					buf.WriteString(" P")
				} else {
					buf.WriteString("  ")
				}

				if msg != nil {
					leader := fmt.Sprintf("[%x] ", vm.ListAck[j].LeaderChainID.Bytes()[:4])
					buf.WriteString("   " + leader + msg.String() + "\n")
				} else {
					buf.WriteString("   <nil>\n")
				}
			}
		}
		buf.WriteString(fmt.Sprintf("===FederatedServersStart=== %d\n", len(p.FedServers)))
		for _, fed := range p.FedServers {
			fedOnline := ""
			if !fed.IsOnline() {
				fedOnline = " F"
			}
			buf.WriteString(fmt.Sprintf("    %x%s\n", fed.GetChainID().Bytes()[:10], fedOnline))
		}
		buf.WriteString(fmt.Sprintf("===FederatedServersEnd=== %d\n", len(p.FedServers)))
		buf.WriteString(fmt.Sprintf("===AuditServersStart=== %d\n", len(p.AuditServers)))
		for _, aud := range p.AuditServers {
			audOnline := " offline"
			if aud.IsOnline() {
				audOnline = " online"
			}
			buf.WriteString(fmt.Sprintf("    %x%v\n", aud.GetChainID().Bytes()[:10], audOnline))
		}
		buf.WriteString(fmt.Sprintf("===AuditServersEnd=== %d\n", len(p.AuditServers)))
		buf.WriteString(fmt.Sprintf("===ProcessListEnd=== %s %d\n", p.State.GetFactomNodeName(), p.DBHeight))
	}
	return buf.String()
}
Example #24
0
func (e *DirectoryBlock) String() string {
	var out primitives.Buffer

	kmr := e.GetKeyMR()
	out.WriteString(fmt.Sprintf("%20s %v\n", "KeyMR:", kmr.String()))

	kmr = e.BodyKeyMR()
	out.WriteString(fmt.Sprintf("%20s %v\n", "BodyMR:", kmr.String()))

	fh := e.GetFullHash()
	out.WriteString(fmt.Sprintf("%20s %v\n", "FullHash:", fh.String()))

	out.WriteString(e.Header.String())
	out.WriteString("Entries: \n")
	for i, entry := range e.DBEntries {
		out.WriteString(fmt.Sprintf("%5d %s", i, entry.String()))
	}

	return (string)(out.DeepCopyBytes())

}
Example #25
0
func (e *DBSignatureEntry) String() string {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf("    E: %20s -- %17s %8x %12s %8s %12s %8x\n", "DB Signature", "IdentityChainID", e.IdentityAdminChainID.Bytes()[:4], "PubKey", e.PrevDBSig.Pub.String()[:8], "Signature", e.PrevDBSig.Sig.String()[:8]))
	return (string)(out.DeepCopyBytes())
}
func (e *AddFederatedServer) String() string {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf("    E: %35s -- %17s %8x %12s %8d\n", "AddFedServer", "IdentityChainID", e.IdentityChainID.Bytes()[:4], "DBHeight", e.DBHeight))
	return (string)(out.DeepCopyBytes())
}
Example #27
0
func (e *ECBlockHeader) String() string {
	var out primitives.Buffer
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "ECChainID", e.GetECChainID().Bytes()[:3]))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "BodyHash", e.BodyHash.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "PrevHeaderHash", e.PrevHeaderHash.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "PrevFullHash", e.PrevFullHash.Bytes()[:3]))
	out.WriteString(fmt.Sprintf("   %-20s %d\n", "DBHeight", e.DBHeight))
	out.WriteString(fmt.Sprintf("   %-20s %x\n", "HeaderExpansionArea", e.HeaderExpansionArea))
	out.WriteString(fmt.Sprintf("   %-20s %d\n", "ObjectCount", e.ObjectCount))
	out.WriteString(fmt.Sprintf("   %-20s %d\n", "BodySize", e.BodySize))

	return (string)(out.DeepCopyBytes())
}